json-stream-stringify
Advanced tools
Comparing version 1.3.0 to 1.3.1
{ | ||
"name": "json-stream-stringify", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "JSON.Stringify as a readable stream", | ||
@@ -5,0 +5,0 @@ "repository": { |
# JSON Stream Stringify | ||
[![NPM version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url] [![Dependency Status][dependency-image]][dependency-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![License][license-image]](LICENSE) [![Gratipay][gratipay-image]][gratipay-url] | ||
[![NPM version][npm-image]][npm-url] | ||
[![NPM Downloads][downloads-image]][downloads-url] | ||
[![Dependency Status][dependency-image]][dependency-url] | ||
[![Build Status][travis-image]][travis-url] | ||
[![Coverage Status][coveralls-image]][coveralls-url] | ||
[![License][license-image]](LICENSE) | ||
[![Gratipay][gratipay-image]][gratipay-url] | ||
JSON Stringify as a Readable Stream with rescursive resolving of any Readable stream and Promises. | ||
JSON Stringify as a Readable Stream with rescursive resolving of any readable streams and Promises. | ||
Main Features: | ||
- Promises are rescursively resolved and the result is piped through JSONStreamify | ||
- Streams (ObjectMode) are piped through a transform which pipes the data through JSONStreamify (enabling recursive streams) | ||
- Streams (Non-ObjectMode) is stringified and piped. | ||
- Output is streamed optimally | ||
## Main Features | ||
- Promises are rescursively resolved and the result is piped through JSONStreamStreamify | ||
- Streams (ObjectMode) are piped through a transform which pipes the data through JSONStreamStreamify (enabling recursive resolving) | ||
- Streams (Non-ObjectMode) is stringified and piped | ||
- Output is streamed optimally with as small chunks as possible | ||
- Great memory management with reference release post process (When a key and value has been processed the value is dereferenced) | ||
@@ -21,5 +27,7 @@ - Stream pressure handling | ||
## API | ||
(value[, replacer]) | ||
- ``value`` Any type to convert to JSON. | ||
- ``replacer`` Function(key, value) or Array. | ||
### JSONStreamStringify(value[, replacer]) | ||
Convert value to JSON string. Returns a readable stream. | ||
- ``value`` Any data to convert to JSON. | ||
- ``replacer`` Optional ``Function(key, value)`` or ``Array``. | ||
As a function the returned value replaces the value associated with the key. [Details](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter) | ||
@@ -79,3 +87,3 @@ As an array all other keys are filtered. [Details](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Example_with_an_array) | ||
## Practical Express + Mongoose Example | ||
## Practical Example with Express + Mongoose | ||
```javascript | ||
@@ -82,0 +90,0 @@ app.get('/api/users', (req, res, next) => JSONStreamify(Users.find().stream()).pipe(res)); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19856
122