json-stream-stringify
Advanced tools
Comparing version
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -45,3 +45,6 @@ 'use strict'; | ||
yield obj.value.pipe(new Transform({ | ||
transform: (data, enc, next) => next(null, JSON.stringify(data.toString()).slice(1, -1)) | ||
transform: (data, enc, next) => { | ||
this.push(JSON.stringify(data.toString()).slice(1, -1)); | ||
next(null); | ||
} | ||
})); | ||
@@ -48,0 +51,0 @@ yield this.push('"'); |
{ | ||
"name": "json-stream-stringify", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "JSON.Stringify as a readable stream", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -37,5 +37,5 @@ # JSON Stream Stringify | ||
```javascript | ||
const JSONStreamStreamify = require('json-stream-stringify'); | ||
const JSONStreamStringify = require('json-stream-stringify'); | ||
JSONStreamStreamify({ | ||
JSONStreamStringify({ | ||
aPromise: Promise.resolve(Promise.resolve("text")), // Promise may resolve more promises and streams which will be consumed and resolved | ||
@@ -48,3 +48,3 @@ aStream: ReadableObjectStream({a:1}, 'str'), // Stream may write more streams and promises which will be consumed and resolved | ||
``` | ||
Output (each line represents a write from JSONStreamStreamify) | ||
Output (each line represents a write from JSONStreamStringify) | ||
``` | ||
@@ -90,3 +90,3 @@ { | ||
```javascript | ||
app.get('/api/users', (req, res, next) => JSONStreamStreamify(Users.find().stream()).pipe(res)); | ||
app.get('/api/users', (req, res, next) => JSONStreamStringify(Users.find().stream()).pipe(res)); | ||
``` | ||
@@ -93,0 +93,0 @@ |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
425
0.71%23866
-2.32%