Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nisaacson/to-string-stream
Stringify a binary stream into strings
https://github.com/nisaacson/to-string-stream
Last synced: about 1 month ago
JSON representation
Stringify a binary stream into strings
- Host: GitHub
- URL: https://github.com/nisaacson/to-string-stream
- Owner: nisaacson
- Created: 2014-01-09T19:15:09.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-01-09T19:56:47.000Z (almost 11 years ago)
- Last Synced: 2024-04-26T12:47:19.939Z (7 months ago)
- Language: JavaScript
- Size: 129 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# To String Stream
Tranform a binary stream into strings
[![NPM](https://nodei.co/npm/to-string-stream.png)](https://nodei.co/npm/to-string-stream/)
[![Build Status](https://travis-ci.org/nisaacson/to-string-stream.png)](https://travis-ci.org/nisaacson/to-string-stream)
[![Dependency Status](https://david-dm.org/nisaacson/to-string-stream/status.png)](https://david-dm.org/nisaacson/to-string-stream)
[![Code Climate](https://codeclimate.com/github/nisaacson/to-string-stream.png)](https://codeclimate.com/github/nisaacson/to-string-stream)# Installation
```bash
npm install -S to-string-stream
```# Usage
Create an instance of to-string and pipe a readable stream of objects into that instance
```javascript
var ToStringStream = require('to-string-stream')
// to-string is an instance of require('stream').Transform
var opts = {
highWaterMark: 2
}
var stringStream = new ToStringStream(opts) // opts is optionalvar readStream = {} // a stream of buffer objects
var stringified = readStream.pipe(stringStream)
stringified.on('data', function(chunk) {
console.dir(chunk) // json string
})
stringified.on('finish', function() {
console.log('finish event called, all objects stringified')
})
```