Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
delimiterstream
Advanced tools
Changelog
0.3.0 ###
wrap
methodReadme
Get delimiter-separated (e.g. new line) chunks of data from a Readable Stream, Websocket or other data source.
Returns a function that calls callback
with a chunk of data as they are received. If options
are passed then you can customize the delimiter
and dataLimit
. Delimiter defaults to \n
.
The chunks will NOT include the delimiter.
v0.3.x is 100% backwards compatible with v0.2.x methods, but they are deprecated. They will be removed in v0.4.x.
Primary use case is with a server endpoint that accepts new-line-delimited data:
var net = require('net'),
DelimiterStream = require('delimiterstream'),
server = net.createServer();
function onSocketLine(line) {
//line will be a buffer
console.log('Received line from', this.remoteAddress, line.toString());
}
server.on('connection', function(socket) {
socket.on('data', DelimiterStream.wrap(onSocketLine, socket));
});
server.listen(9999);
It also works with files:
var fs = require('fs'),
DelimiterStream = require('delimiterstream');
fs.readFile('example.csv', DelimiterStream.wrap(function(line) {
//line will be a Buffer
console.log(line.toString());
});
By James Hartig
FAQs
Get delimiter-separated chunks of data from a Readable Stream.
The npm package delimiterstream receives a total of 18 weekly downloads. As such, delimiterstream popularity was classified as not popular.
We found that delimiterstream 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
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.