mirror of
https://github.com/zhigang1992/replace-in-file.git
synced 2026-01-12 22:51:48 +08:00
ec8209b2b04e5bcbc43317aed638345f278286d2
Replace in file
A simple utility to quickly replace text in one or more files.
Installation
npm install replace-in-file
Usage
var replace = require('replace-in-file');
replace({
//Single file
files: 'path/to/file',
//Or multiple files
files: [
'path/to/file',
'path/to/other/file',
],
//Replacement to make (can be string or regex)
replace: /Find me/g,
with: 'Replacement'
}, function(error, changedFiles) {
//Catch errors
if (error) {
return console.error('Error occurred:', error);
}
//List changed files
console.log('Modified files:', changedFiles.join(', '));
});
License
(MIT License)
Copyright 2015, Adam Buczynski
Description
Languages
JavaScript
100%