Security News
Internet Archive Hacked, 31 Million Record Compromised
The Internet Archive's "Wayback Machine" has been hacked and defaced, with 31 millions records compromised.
readline-transform
Advanced tools
Reading String or Buffer content from a Readable stream and writing each line which ends without line break as object
$ npm install -save readline-transform
new ReadlineTransform(options)
options
<Object>
breakMatcher
is the regular expression to split content by line break for str.split()
. (default: /\r?\n/
)ignoreEndOfBreak
is boolean. if content ends with line break, ignore last empty line. (default: true
)skipEmpty
is boolean. if line is empty string, skip it (default: false
)const { PassThrough } = require('stream');
const ReadlineTransform = require('readline-transform');
const readStream = new PassThrough();
const transform = new ReadlineTransform({ skipEmpty: true });
const writeStream = new PassThrough({ objectMode: true });
writeStream.on('data', (line) => {
console.log(line);
}).on('finish', () => {
console.log('<<< all done >>>');
});
readStream.pipe(transform).pipe(writeStream);
readStream.write(new Buffer('foo\nba'));
readStream.write(new Buffer('r\r\n\n\r'));
readStream.end(new Buffer('\nbaz'));
});
$ node example.js
foo
bar
baz
<<< all done >>>
FAQs
Transform stream to read line-by-line and write a string
The npm package readline-transform receives a total of 158,995 weekly downloads. As such, readline-transform popularity was classified as popular.
We found that readline-transform 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
The Internet Archive's "Wayback Machine" has been hacked and defaced, with 31 millions records compromised.
Security News
TC39 is meeting in Tokyo this week and they have approved nearly a dozen proposals to advance to the next stages.
Security News
Our threat research team breaks down two malicious npm packages designed to exploit developer trust, steal your data, and destroy data on your machine.