Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deebloo/find-and-replace
Find and replace node js module
https://github.com/deebloo/find-and-replace
Last synced: 3 months ago
JSON representation
Find and replace node js module
- Host: GitHub
- URL: https://github.com/deebloo/find-and-replace
- Owner: deebloo
- Created: 2014-09-07T21:36:09.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T05:19:43.000Z (about 1 year ago)
- Last Synced: 2024-10-05T13:07:40.879Z (3 months ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![NPM](https://nodei.co/npm/find-and-replace.png?compact=true)](https://nodei.co/npm/find-and-replace/)
Find and Replace
=========A simple api for finding and replacing values in a file.
## Installation
```
npm i find-and-replace --save
```## API
```JS
var find = require('find-and-replace');find
.src('./test.txt')
// .text('if you want to just use text')
.dest('./test2.txt')
.replace({
'%Heading%': 'Good Morning San Diego!',
'%Footer%': 'Let\'s all play Yaz Flute'
})
// fires when find and replace is finished and gives you the replaced text from either the file or the raw text
.complete(function (txt) {
console.log('Finished! Here is the completed text: ' + txt);
})
// add an error callback
.error(function (err) {
console.log(err);
});
```* 1.0.2