# appendit

> Appendit allows you easily to add text at a specific line. It will works with any plain text format like ```.txt``` ```.md``` ```.js``` ...

Latest version **0.1.2** (published 2014-02-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install appendit
pnpm add appendit
yarn add appendit
bun add appendit
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2014-02-25 |
| First published | 2014-01-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| Author | Stefan Buck |
| Maintainers | stefanbuck |

## Links

- npm: https://www.npmjs.com/package/appendit
- Repository: https://github.com/stefanbuck/appendit
- Issues: https://github.com/stefanbuck/appendit/issues
- npm.io page: https://npm.io/package/appendit

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ~2.4.1

## Recent versions

- 0.1.2 (latest) — 2014-02-25
- 0.1.1 — 2014-02-04
- 0.1.0 — 2014-01-29

## 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

```npm install --save appendit```

# Example

Below a quick example how to use appendit:


The ```index.html``` looks like that:

```
<html>
	<head>
		<title></title>
		<!-- anchor -->
	</head>
	<body>
	</body>
</html>
```
Call the ```appendit``` function with the following parameters:

```
var fs = require('fs');
var appendit = require('appendit');

var content = appendit({
  source: fs.readFileSync('index.html', 'utf8'),
  anchor: '<!-- anchor -->',
  content: [
    '<script src="main.js"></script>'
  ]
});

fs.writeFileSync('index.html', content);
```

Output: 

```
<html>
	<head>
		<title></title>
		<script src="main.js"></script>
		<!-- anchor -->
	</head>
	<body>
	</body>
</html>
```

###One more

Let's add a headline to the body:

```
appendit({
  source: fs.readFileSync('index.html', 'utf8'),
  anchor: '</body>',
  content: [
    '<h1>Hello Node!</h1>'
  ]
})
```

Output: 

```
<html>
	<head>
		<title></title>
		<script src="main.js"></script>
		<!-- anchor -->
	</head>
	<body>
		<h1>Hello Node!</h1>
	</body>
</html>
```

# Testing
Running ```npm test```will run the unit tests with mocha

---
_Source: https://npm.io/package/appendit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
