1.0.2 • Published 7 years ago

ldif-reader v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

A simple event-based LDIF file reader.

Usage

Install the ldif-reader library to your project:

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

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:

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.
1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago