If I do the same than the example code showed at main page but using a file (called datos.json) containing this JSON data : http://isaacs.couchone.com/registry/_all_docs (this Json data is used in JSONStream examples and I've validated by http://www.freeformatter.com/json-validator.html and others), that is to say: if I do this:
var fs = require('fs');
var logstream = fs.createReadStream('datos.json');
var split = new require('split')();
var JsonMaskStream = require('json-mask-stream');
var maskStream = new JsonMaskStream('key,rev');
logstream.pipe(split).pipe(maskStream).pipe(process.stdout)
I get this error:
undefined:1
{"total_rows":78865,"offset":0,"rows":[
^
SyntaxError: Unexpected end of input
at Object.parse (native)
at JsonMaskStream.self._transform (/home/q2dg/node_modules/json-mask-stream/index.js:18:22)
at JsonMaskStream.Transform._read (_stream_transform.js:179:10)
at JsonMaskStream.Transform._write (_stream_transform.js:167:12)
at doWrite (_stream_writable.js:262:12)
at writeOrBuffer (_stream_writable.js:249:5)
at JsonMaskStream.Writable.write (_stream_writable.js:194:11)
at Stream.ondata (stream.js:51:26)
at Stream.EventEmitter.emit (events.js:104:17)
at drain (/home/q2dg/node_modules/through/index.js:36:16)
I'm using Fedora 20, Node 0.11.12
If I do the same than the example code showed at main page but using a file (called datos.json) containing this JSON data : http://isaacs.couchone.com/registry/_all_docs (this Json data is used in JSONStream examples and I've validated by http://www.freeformatter.com/json-validator.html and others), that is to say: if I do this:
var fs = require('fs');
var logstream = fs.createReadStream('datos.json');
var split = new require('split')();
var JsonMaskStream = require('json-mask-stream');
var maskStream = new JsonMaskStream('key,rev');
logstream.pipe(split).pipe(maskStream).pipe(process.stdout)
I get this error:
undefined:1
{"total_rows":78865,"offset":0,"rows":[
^
SyntaxError: Unexpected end of input
at Object.parse (native)
at JsonMaskStream.self._transform (/home/q2dg/node_modules/json-mask-stream/index.js:18:22)
at JsonMaskStream.Transform._read (_stream_transform.js:179:10)
at JsonMaskStream.Transform._write (_stream_transform.js:167:12)
at doWrite (_stream_writable.js:262:12)
at writeOrBuffer (_stream_writable.js:249:5)
at JsonMaskStream.Writable.write (_stream_writable.js:194:11)
at Stream.ondata (stream.js:51:26)
at Stream.EventEmitter.emit (events.js:104:17)
at drain (/home/q2dg/node_modules/through/index.js:36:16)
I'm using Fedora 20, Node 0.11.12