Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hughsk/wrap-stream
Wrap the output of a stream with a prefix and/or suffix.
https://github.com/hughsk/wrap-stream
Last synced: 8 days ago
JSON representation
Wrap the output of a stream with a prefix and/or suffix.
- Host: GitHub
- URL: https://github.com/hughsk/wrap-stream
- Owner: hughsk
- License: mit
- Created: 2013-10-06T07:33:11.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-08-03T11:51:34.000Z (over 8 years ago)
- Last Synced: 2024-10-17T16:39:03.609Z (22 days ago)
- Language: JavaScript
- Size: 123 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# wrap-stream [![unstable](http://hughsk.github.io/stability-badges/dist/unstable.svg)](http://github.com/hughsk/stability-badges) #
Wrap the output of a stream with a prefix and/or suffix.
Streams2 compliant.
## Usage ##
[![wrap-stream](https://nodei.co/npm/wrap-stream.png?mini=true)](https://nodei.co/npm/wrap-stream)
### `wrap(pre, post)` ###
Returns a through stream that adds `pre` before any other output and `post`
after calling `stream.end()`.``` javascript
var wrap = require('wrap-stream')
var fs = require('fs')fs.createReadStream(__filename)
.pipe(wrap('hello', 'world'))
.pipe(process.stdout)
```If you'd prefer not to use either of `pre` or `post`, just pass `null` in its
place.``` javascript
var wrap = require('wrap-stream')
var fs = require('fs')fs.createReadStream(__filename)
.pipe(wrap(null, 'lorem ipsum'))
.pipe(process.stdout)
```## License ##
MIT. See [LICENSE.md](http://github.com/hughsk/wrap-stream/blob/master/LICENSE.md) for details.