Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
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
The npm package ldif-stream receives a total of 174 weekly downloads. As such, ldif-stream popularity was classified as not popular.
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.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.