https://github.com/stefanbuck/appendit
Append text to a specific line
https://github.com/stefanbuck/appendit
Last synced: 3 months ago
JSON representation
Append text to a specific line
- Host: GitHub
- URL: https://github.com/stefanbuck/appendit
- Owner: stefanbuck
- Created: 2014-01-27T23:30:22.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-04-07T20:28:44.000Z (about 11 years ago)
- Last Synced: 2025-02-14T02:52:00.881Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 242 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#Appendit [](http://badge.fury.io/js/appendit) [](https://travis-ci.org/stefanbuck/appendit) [](https://coveralls.io/r/stefanbuck/appendit) [](https://david-dm.org/stefanbuck/appendit)
Appendit allows you easily to add text at a specific line. It will works with any plain text format like ```.txt``` ```.md``` ```.js``` ...
## Installation
```bash
npm install appendit
```## Example
Below a quick example how to use appendit:
The ```index.html``` looks like that:
```html
```
Call the ```appendit``` function with the following parameters:```js
var fs = require('fs');
var appendit = require('appendit');var content = appendit({
source: fs.readFileSync('index.html', 'utf8'),
anchor: '',
content: [
''
]
});fs.writeFileSync('index.html', content);
```Output:
```html
```
###One more
Let's add a headline to the body:
```js
appendit({
source: fs.readFileSync('index.html', 'utf8'),
anchor: '
Hello Node!