+10
-0
@@ -0,1 +1,11 @@ | ||
| ## 1.1.0 | ||
| #### Chore | ||
| * fix changelog bug with versioning ([aa23d6b](https://github.com/DonutEspresso/big-json/commit/aa23d6b0cc70c4032625bac0bc6b0880cf603f97)) | ||
| #### New | ||
| * add support for multibyte chars (#2) ([ec4bb36](https://github.com/DonutEspresso/big-json/commit/ec4bb3661ecde84c2d214e4b8d24a4f9725d8722)) | ||
| ## 1.0.0 | ||
@@ -2,0 +12,0 @@ |
+20
-2
@@ -9,2 +9,3 @@ 'use strict'; | ||
| const stringifyStreamFactory = require('json-stream-stringify'); | ||
| const utf8Stream = require('utf8-stream'); | ||
@@ -38,6 +39,16 @@ | ||
| * @public | ||
| * @param {Object} [options] an options object | ||
| * @param {Object} [options.multibyte] when true, support multibyte | ||
| * @function createParseStream | ||
| * @return {Stream} | ||
| */ | ||
| function createParseStream() { | ||
| function createParseStream(options) { | ||
| const opts = Object.assign({ | ||
| multibyte: true | ||
| }, options); | ||
| assert.optionalObject(opts, 'opts'); | ||
| assert.optionalBool(opts.multibyte, 'opts.multibyte'); | ||
| const assembler = new Assembler(); | ||
@@ -68,3 +79,10 @@ const parseStream = new JSONParseStream({ | ||
| source.unpipe(this); | ||
| this.transformStream = source.pipe(parseStream); | ||
| // pipe the stream, prepend with multibyte if necessary. utf8stream can | ||
| // never error, so no need to handle errors here. | ||
| if (opts.multibyte === true) { | ||
| this.transformStream = source.pipe(utf8Stream()).pipe(parseStream); | ||
| } else { | ||
| this.transformStream = source.pipe(parseStream); | ||
| } | ||
| redirected = true; | ||
@@ -71,0 +89,0 @@ }); |
+3
-2
| { | ||
| "name": "big-json", | ||
| "version": "1.0.0", | ||
| "version": "1.1.0", | ||
| "main": "lib/index.js", | ||
@@ -40,4 +40,5 @@ "description": "A stream based implementation of JSON.parse and JSON.stringify for big POJOs", | ||
| "stream-json": "^0.5.2", | ||
| "through2": "^2.0.3" | ||
| "through2": "^2.0.3", | ||
| "utf8-stream": "0.0.0" | ||
| } | ||
| } |
+4
-1
@@ -87,4 +87,7 @@ # big-json | ||
| ### createParseStream() | ||
| ### createParseStream(opts) | ||
| * `opts` {Object} an options object | ||
| * `opts.multibyte` {Boolean} handle multibyte chars, defaults to true | ||
| __Returns__: {Stream} a JSON.parse stream | ||
@@ -91,0 +94,0 @@ |
12539
9.47%114
14%128
2.4%5
25%+ Added
+ Added
+ Added
+ Added
+ Added