851 GitHub stars and counting — winterbe/streamjs is a JavaScript project TopGit is tracking across repositories on the platform. Lazy Object Streaming Pipeline for JavaScript
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
ATTENTION: Stream.js is no longer maintained in favor of it's successor library Sequency. If you already use Stream.js in your project I recommend switching to Sequency. But don't worry, Stream.js still works fine so no hurry. 😉
Lazy Object Streaming Pipeline for JavaScript - inspired by the Java 8 Streams API
Stream.js is a lightweight (2.6 KB minified, gzipped), intensely tested (700+ assertions, 97% coverage) functional programming library for operating upon collections of in-memory data. It requires EcmaScript 5+, has built-in support for ES6 features and works in all current browsers, Node.js and Java 8 Nashorn.
Download the latest release from GitHub or install Stream.js via NPM or Bower:
npm install streamjs
# or
bower install streamjs
Read the APIDOC
Examples
Before explaining how Stream.js works in detail, here's a few real world code samples.
Filter and sort a collection of persons, then group everything by age.
Filter and transform a collection of tweets to its text content, then limit the tweets to a maximum of 100 and partition the results into 10 tweets per page:
Streams are monadic types with a bunch of useful operations. Those functions can be chained one after another to make complex computations upon the input elements. Operations are either intermediate or terminal. Intermediate operations are lazy and return the stream itself to enable method chaining. Terminal operations return a single result (or nothing at all). Some terminal operations return a special monadic Optional type which is described later.
Streams are not limited to finite data sources like collections. You can also create infinite streams of elements by utilizing generator or iterator functions.
Stream.iterate(1, function (seed) {
return seed * 2;
});
Why Stream.js?
What's so different between Stream.js and other functional libraries like Underscore.js?
Stream.js is built around a lazily evaluated operation pipeline. Instead of consecutively performing each operation on the whole input collection, objects are passed vertically and one by one upon the chain. Interim results will not be stored in internal collections (except for some stateful operations like sorted). Instead objects are directly piped into the resulting object as specified by the terminal operation. This results in minimized memory consumption and internal state.
Stream operations are lazily evaluated to avoid examining all of the input data when it's not necessary. Streams always perform the minimal amount of operations to gain results. E.g. in a filter - map - findFirst stream you don't have to filter and map the whole data. Instead map and findFirst are executed just one time before returning the single result. This results in increased performance when operation upon large amounts of input elements.
Stream([1, 2, 3, 4])
.filter(function(num) { // called twice
return num % 2 === 0;
})
.map(function(even) { // called once
return "even" + even;
})
.findFirst(); // called once
API Documentation
The Stream.js API is described in detail here. For more information about Java 8 Streams I recommend reading the official Javadoc and this blog post.
A type definition for using Stream.js with Typescript is available here.
Contributing
Found a bug or missing feature? Please open an issue! Your feedback and help is highly appreciated. Please refer to the contributing rules before sending a pull request. I would also love to hear your feedback via Twitter.
Copyright and license
Created and copyright (c) 2014-2016 by Benjamin Winterberg.
Stream.js may be freely distributed under the MIT license.
The most recent commit recorded on winterbe/streamjs was 9.3 years ago, based on the GitHub push timestamp. The repository has 65 forks — one of the better signals of community interest.
How does winterbe/streamjs compare to other Frontend projects?
winterbe/streamjs is tracked by TopGit in the Frontend category, with 851 GitHub stars and written in JavaScript. Browse the Frontend topic page on TopGit to compare it against similar projects by stars and activity.
How many stars does winterbe/streamjs have?
winterbe/streamjs has 851 GitHub stars — refresh the page for the live number, or check github.com/winterbe/streamjs. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is winterbe/streamjs open source?
Yes — winterbe/streamjs ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/winterbe/streamjs.
What is winterbe/streamjs?
winterbe/streamjs (winterbe/streamjs) is a JavaScript project on GitHub. From the project's own README: Lazy Object Streaming Pipeline for JavaScript
Where do I read more about winterbe/streamjs?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/winterbe/streamjs is the definitive source.
Read full README in the tab above.
Curious whether streamjs is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about streamjs.