Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jakeburden/scoot-stream
stream.write(JSON.stringify(obj) + '\n') shortcut
https://github.com/jakeburden/scoot-stream
Last synced: 1 day ago
JSON representation
stream.write(JSON.stringify(obj) + '\n') shortcut
- Host: GitHub
- URL: https://github.com/jakeburden/scoot-stream
- Owner: jakeburden
- Created: 2016-06-28T19:50:40.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-14T17:33:38.000Z (over 7 years ago)
- Last Synced: 2024-04-24T01:20:34.423Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.markdown
Awesome Lists containing this project
README
# scoot-stream
[![build status](http://img.shields.io/travis/jekrb/scoot-stream.svg?style=flat)](http://travis-ci.org/jekrb/scoot-stream)
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
stream.write(JSON.stringify(obj) + '\n') shortcut
## Install
```
npm install scoot-stream -S
```## Usage
```js
const scoot = require('scoot-stream')
const through = require('through2')
const split = require('split2')const so = scoot('hello')
const stream = through()
const sp = stream.pipe(split(JSON.parse))sp.on('error', console.log)
sp.pipe(through(row, enc, next) => {
if (row.hello) {
console.log(row.hello) // world
}if (row.foo) {
console.log(row.foo) // bar
}
})so(stream, 'world')
so(stream, {
foo: 'bar'
})
```## API
#### `scoot(String)`
Pass in a base string for scoot use as the property of the object you're stringifying.
#### `so(Stream, String)`
Pass in a writable stream and a string to use as the value for the object you're stringifying.
#### `so(Stream, Object)`
Pass in a writable stream and an object to stringify.