An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

        

#Appendit [![NPM version](https://badge.fury.io/js/appendit.png)](http://badge.fury.io/js/appendit) [![Build Status](https://travis-ci.org/stefanbuck/appendit.png?branch=master)](https://travis-ci.org/stefanbuck/appendit) [![Coverage Status](https://coveralls.io/repos/stefanbuck/appendit/badge.png)](https://coveralls.io/r/stefanbuck/appendit) [![Dependency Status](https://david-dm.org/stefanbuck/appendit.png?theme=shields.io)](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!