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

mhysa

v1.0.2

Published

Streams and event emitter utils for Node.js

Downloads

5

Readme

Mhysa

Dependency-free stream utils for Node.js

Released under the MIT license.

yarn add mhysa

Tested with Node.js versions 8+

fromArray(array)

Convert an array into a Readable stream of its elements

| Param | Type | Description | | --- | --- | --- | | array | T[] | Array of elements to stream |

map(mapper, options)

Return a ReadWrite stream that maps streamed chunks

| Param | Type | Description | | --- | --- | --- | | mapper | (chunk: T, encoding: string) => R | Mapper function, mapping each (chunk, encoding) to a new chunk (or a promise of such) | | options | object | | | options.readableObjectMode | boolean | Whether this stream should behave as a readable stream of objects | | options.writableObjectMode | boolean | Whether this stream should behave as a writable stream of objects |

flatMap(mapper, options)

Return a ReadWrite stream that flat maps streamed chunks

| Param | Type | Description | | --- | --- | --- | | mapper | (chunk: T, encoding: string) => R[] | Mapper function, mapping each (chunk, encoding) to an array of new chunks (or a promise of such) | | options | object | | | options.readableObjectMode | boolean | Whether this stream should behave as a readable stream of objects | | options.writableObjectMode | boolean | Whether this stream should behave as a writable stream of objects |

filter(predicate, options)

Return a ReadWrite stream that filters out streamed chunks for which the predicate does not hold

| Param | Type | Description | | --- | --- | --- | | predicate | (chunk: T, encoding: string) => boolean | Predicate with which to filter scream chunks | | options | object | | | options.objectMode | boolean | boolean | Whether this stream should behave as a stream of objects |

reduce(iteratee, initialValue, options)

Return a ReadWrite stream that reduces streamed chunks down to a single value and yield that value

| Param | Type | Description | | --- | --- | --- | | iteratee | (chunk: T, encoding: string) => R | Reducer function to apply on each streamed chunk | | initialValue | T | Initial value | | options | object | | | options.readableObjectMode | boolean | Whether this stream should behave as a readable stream of objects | | options.writableObjectMode | boolean | Whether this stream should behave as a writable stream of objects |

split(separator)

Return a ReadWrite stream that splits streamed chunks using the given separator

| Param | Type | Description | | --- | --- | --- | | separator | string | Separator to split by, defaulting to "\n" |

join(separator)

Return a ReadWrite stream that joins streamed chunks using the given separator

| Param | Type | Description | | --- | --- | --- | | separator | string | Separator to join with |

replace(searchValue, replaceValue)

Return a ReadWrite stream that replaces occurrences of the given string or regular expression in the streamed chunks with the specified replacement string

| Param | Type | Description | | --- | --- | --- | | searchValue | string | RegExp | Search string to use | | replaceValue | string | Replacement string to use |

parse()

Return a ReadWrite stream that parses the streamed chunks as JSON

stringify()

Return a ReadWrite stream that stringifies the streamed chunks to JSON

collect(options)

Return a ReadWrite stream that collects streamed chunks into an array or buffer

| Param | Type | Description | | --- | --- | --- | | options | object | | | options.objectMode | boolean | Whether this stream should behave as a stream of objects |

concat(streams)

Return a Readable stream of readable streams concatenated together

| Param | Type | Description | | --- | --- | --- | | streams | ...Readable[] | Readable streams to concatenate |

merge(streams)

Return a Readable stream of readable streams merged together in chunk arrival order

| Param | Type | Description | | --- | --- | --- | | streams | ...Readable[] | Readable streams to merge |

duplex(writable, readable)

Return a Duplex stream from a writable stream that is assumed to somehow, when written to, cause the given readable stream to yield chunks

| Param | Type | Description | | --- | --- | --- | | writable | Writable | Writable stream assumed to cause the readable stream to yield chunks when written to | | readable | Readable | Readable stream assumed to yield chunks when the writable stream is written to |

child(childProcess)

Return a Duplex stream from a child process' stdin and stdout

| Param | Type | Description | | --- | --- | --- | | childProcess | ChildProcess | Child process from which to create duplex stream |

last(readable)

Return a Promise resolving to the last streamed chunk of the given readable stream, after it has ended

| Param | Type | Description | | --- | --- | --- | | readable | Readable | Readable stream to wait on |