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

next-stream

v2.2.2

Published

Concatenate a series of streams 'end-to-end'.

Downloads

2,192

Readme

next-stream Build Status

Concatenate/attach a series of streams a,b,c,... "end-to-end", so that the result streams from a until it ends, then moves on to b till it ends, etc.

If you don't need mutation, laziness, or non-streams, you should probably just use stream-cat.

Supports:

  • (limited) mutation: Append additional streams after creation with push(stream).
  • laziness: If anything in the series is a function instead of a stream, it will be called when its 'turn' comes up, and its return value will be used in its place.
  • non-stream items: If anything in the series is not a readable stream just push it through as a chunk at the appropriate time.
  • stream errors: If any of the given streams in the series emits an error, propagate it.

Usage

var next = require('next-stream');

var stream1 = fs.createReadStream('file1.txt'),
    stream2 = fs.createReadStream('file2.txt'),
    joined = next([stream1, stream2]);

joined.push(fs.createReadStream('file3.txt'));
joined.close(); // tell `joined` to emit `end` when the last stream ends.

joined.pipe(process.stdout);

Outputs contents of file1.txt followed by contents of file2.txt and then the contents of file3.txt.

For convenience, non-stream inputs also work as you'd expect:

var next = require('next-stream');

var stream1 = fs.createReadStream('file1.txt'),
stream2 = fs.createReadStream('file2.txt'),
joined = next([stream1, '--------- between ---------', stream2]);

joined.pipe(process.stdout);

Outputs contents of file1.txt, followed by '--------- between ---------', followed by contents of file2.txt.

Methods

var joined = next([stream1, stream2, stream3], opts);

Create a new readable next-stream from the readable streams stream1, stream2, stream3.

By default, joined is in open-ended mode, which means it won't emit 'end' when the last stream in the list ends. Setting opts.open to false causes joined to end when the last stream ends.

joined.push(stream4)

Add stream4 to the end of the list of streams.

joined.close()

Close joined if it is in open-ended mode.

Events

'next'

Emitted when we've hit the end event of the current stream. Event payload is the next stream, or null if there are none.