Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gobengo/stream-slice
slice streams (e.g. to make an infinite one N-finite)
https://github.com/gobengo/stream-slice
Last synced: 25 days ago
JSON representation
slice streams (e.g. to make an infinite one N-finite)
- Host: GitHub
- URL: https://github.com/gobengo/stream-slice
- Owner: gobengo
- Created: 2014-06-17T06:56:41.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-17T06:57:32.000Z (over 10 years ago)
- Last Synced: 2024-10-03T15:29:48.335Z (about 1 month ago)
- Language: JavaScript
- Size: 133 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# stream-slice
Create a [stream](https://github.com/Livefyre/stream)/Transform that slices a stream piped into it. For example, take an infinite [stream-cycle](https://github.com/gobengo/stream-cycle) and limit it to N objects.
A lot like Python's [itertools.islice](https://docs.python.org/2/library/itertools.html#itertools.islice)
## Example
```javascript
var cycle = require('stream-cycle');
var slice = require('stream-slice');var infinite = cycle([1,0]);
var only5 = infinite.pipe(slice(100));
only5
.on('end', function () {
console.log('ended after 5');
})
.on('data', console.log);// 1
// 0
// 1
// 0
// 1
// ended after 5
```## `make` commands
* `make build` - will `npm install` and `bower install`
* `make dist` - will use r.js optimizer to compile the source, UMD wrap, and place that and source maps in dist/
* `make clean`
* `make server` - serve the repo over http
* `make deploy [env={*prod,uat,qa}]` - Deploy to lfcdn, optionally specifying a bucket env