npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

split-join-stream

v1.0.9

Published

Split inbound stream into messages with a delimeter, append this delimiter to outgoing chunks

Downloads

1

Readme

Split-Join-Stream

Break up a readable stream of messages separated by the delimiter, and reassemble it so that each write to the target stream is a whole message. Read messages from the target stream, append the delimiter to them, and pipe that to the writable. Utf8 encoding is used to encode the delimiter.

Example, read messages separated by \0, and then writen them with \0 added.

var PassThrough = require('stream').PassThrough;
var splitJoinStream = require('split-join-stream');

var target = new PassThrough();
var readable = new PassThrough();
var writable = new PassThrough();

var result = splitJoinStream(readable, target, writable, delimiter); // result === target.

readable.push('foo\0bar\0bazz\0');
readable.push('split');
readable.push('line\0');
readable.push('\0');
readable.push('one-line\0');
readable.push(null);

// target stream will get the following chunks:
// 'foo', 'bar', 'bazz', 'splitline', 'one-line'

// writable will get the following writes:
// 'foo\0', 'bar\0', 'bazz\0', 'splitline\0', 'one-line\0'

Reading only (splitting)

If writable is null, then the behavior is the same as

readable.pipe(split(delimiter, null, {trailing: false})).pipe(target);

Writing only (joining)

If readable is null, then each chunk of data in target stream is written to writable with the trailing delimiter appended to it. Utf8 encoding is used to encode the delimiter.

License

MIT