
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
ldif-stream
Advanced tools
What's better than awesomely parsing an LDIF file in an RFC-compliant way? Parsing it in a Node stream! This small library makes it easy.
Based on my ldif parsing package.
npm install ldif-stream
var Streamer = require('ldif-stream');
var options = {};
Streamer.file('./example.ldif',options)
.on('data',function(data){
console.log('Found LDIF data');
console.log(data);
})
.on('end',function(){
console.log('All done!');
});
var Streamer = require('ldif-stream');
var stream = fs.createReadStream('example.ldif','utf8');
var options = {};
Streamer(stream,options)
.on('data',function(data){
console.log('Found LDIF data');
console.log(data);
})
.on('end',function(){
console.log('All done!');
});
Since there are many ways the data could be transformed to be useful,
this library allows you to specify an array of transformations in the
pipeline
option. Each transformation receives the options
passed
in to the stream when it was created.
The default pipeline is [ Streamer.record, Streamer.object ]
.
This breaks the stream into individual records (probably already happened with
line splitting), and then converts each record into an object.
The available transformations are described below.
The ldif
library parses a string of LDIF into a containerized format that
includes a little outer cruft to wrap the entries contained in the file.
This transformation breaks out any records contained in each chunk, into
separate chunks, one record each.
The internal parsed format and the "object" format both have an
entries
key, so this transformation can work on either as input.
It simply shifts records off of entries
and emits a new chunk for
each record.
Transforms single records (or entire containers) into a simple object format.
Reference the ldif
package documentation for toObject()
and it's associated
options, which can be mixed into the options given to the streamer, to alter
the behavior of the output of this transformation.
Not really sure why you'd want to stream back into LDIF format, but why not? This will return a chunk of parsed and re-outputted LDIF for each chunk it receives.
FAQs
Read LDIF entries as a stream
We found that ldif-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.