# ldif-reader

> A simple event-based LDIF file reader

Latest version **1.0.2** (published 2017-07-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install ldif-reader
pnpm add ldif-reader
yarn add ldif-reader
bun add ldif-reader
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2017-07-13 |
| First published | 2017-05-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Casey Dement |
| Maintainers | cadement |

## Links

- npm: https://www.npmjs.com/package/ldif-reader
- Repository: https://github.com/Sharecare/LDIFReader
- Homepage: https://github.com/Sharecare/LDIFReader.git#readme
- Issues: https://github.com/Sharecare/LDIFReader/issues
- npm.io page: https://npm.io/package/ldif-reader

## Recent versions

- 1.0.2 (latest) — 2017-07-13
- 1.0.1 — 2017-05-24
- 1.0.0 — 2017-05-24

## README

A simple event-based LDIF file reader.

## Usage
Install the `ldif-reader` library to your project:

```bash
> npm install --save ldif-reader
```

Import and create a new instance of the `ldif-reader` library.  The constructor takes a string value that contains either a relative or absolute path to the target LDIF file:

```javascript
const LDIFReader = require('ldif-reader'),
      ldifReader = new LDIFReader('/some/file.ldif');
```

Then listen for the `record` event and act upon each record that has been loaded from the file:

```javascript
ldifReader.on('record', record -> {
	console.log(`loaded ${record.someId} having ${record.someProperty}`);
});
```

## Parsing
The `ldif-reader` library parses the LDIF source using the following rules:
 * The boundary between a key and a value on any line of the LDIF file is indicated by a `":"` character.  Additional instances of this character on a line have no semantic meaning.
 * Record boundaries are indicated with a line containing the value `"-"`.  Multiple sequential lines with this value are treated as a single record boundary.
 * Lines that begin with a `" "` (space) character are considered continuations of the value from the previous line.
 * Multiple instances of the same key on a single record are treated as an array of values with the given key.

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