Gathering detailed insights and metrics for byline
Gathering detailed insights and metrics for byline
Gathering detailed insights and metrics for byline
Gathering detailed insights and metrics for byline
npm install byline
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.9
Supply Chain
100
Quality
75.9
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
324 Stars
84 Commits
47 Forks
5 Watchers
2 Branches
3 Contributors
Updated on Feb 11, 2025
Latest Version
5.0.0
Package Id
byline@5.0.0
Size
3.60 kB
NPM Version
3.6.0
Node Version
5.6.0
Published on
Jul 21, 2016
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
byline
is a simple module providing a LineStream
.
streams2
(transform stream)pipe
stream = byline(stream);
npm install byline
or from source:
git clone git://github.com/jahewson/node-byline.git
cd node-byline
npm link
The byline
module can be used as a function to quickly wrap a readable stream:
1var fs = require('fs'), 2 byline = require('byline'); 3 4var stream = byline(fs.createReadStream('sample.txt', { encoding: 'utf8' }));
The data
event then emits lines:
1stream.on('data', function(line) { 2 console.log(line); 3});
You just need to add one line to wrap your readable Stream
with a LineStream
.
1var fs = require('fs'), 2 byline = require('byline'); 3 4var stream = fs.createReadStream('sample.txt'); 5stream = byline.createStream(stream); 6 7stream.on('data', function(line) { 8 console.log(line); 9});
byline
supports pipe
(though it strips the line endings, of course).
1var stream = fs.createReadStream('sample.txt'); 2stream = byline.createStream(stream); 3stream.pipe(fs.createWriteStream('nolines.txt'));
Alternatively, you can create a readable/writable "through-stream" which doesn't wrap any specific stream:
1var stream = fs.createReadStream('sample.txt'); 2stream = byline.createStream(stream); 3stream.pipe(fs.createWriteStream('nolines.txt')); 4 5var input = fs.createReadStream('LICENSE'); 6var lineStream = byline.createStream(); 7input.pipe(lineStream); 8 9var output = fs.createWriteStream('test.txt'); 10lineStream.pipe(output);
Node v0.10 added a new streams2 API. This allows the stream to be used in non-flowing mode and is preferred over the legacy pause() and resume() methods.
1var stream = fs.createReadStream('sample.txt'); 2stream = byline.createStream(stream); 3 4stream.on('readable', function() { 5 var line; 6 while (null !== (line = stream.read())) { 7 console.log(line); 8 } 9});
The byline
transform stream can be directly manipulated like so:
1var LineStream = require('byline').LineStream; 2 3var input = fs.createReadStream('sample.txt'); 4var output = fs.createWriteStream('nolines.txt'); 5 6var lineStream = new LineStream(); 7input.pipe(lineStream); 8lineStream.pipe(output); 9
By default byline skips empty lines, if you want to keep them, pass the keepEmptyLines
option in
the call to byline.createStream(stream, options)
or byline(stream, options)
.
npm test
If you want to use node-byline
with node v0.8 then you can use the 2.1.x series. Simply use the
following in your package.json
:
1 "dependencies": { 2 "byline": ">=2.1.0 <3.0.0" 3},
Unlike other modules (of which there are many), byline
contains no:
pipe
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 2/29 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More