Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stream-json

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-json - npm Package Compare versions

Comparing version 1.3.2 to 1.3.3

2

package.json
{
"name": "stream-json",
"version": "1.3.2",
"version": "1.3.3",
"description": "stream-json is the micro-library of Node.js stream components for creating custom JSON processing pipelines with a minimal memory footprint. It can parse JSON files far exceeding available memory streaming individual primitives using a SAX-inspired API. Includes utilities to stream JSON database dumps.",

@@ -5,0 +5,0 @@ "homepage": "http://github.com/uhop/stream-json",

@@ -18,2 +18,3 @@ 'use strict';

};
const MAX_PATTERN_SIZE = 16;

@@ -119,4 +120,6 @@ let noSticky = true;

if (!match) {
if (index < this._buffer.length && this._done) return callback(new Error('Parser cannot parse input: expected a value'));
if (this._done) return callback(new Error('Parser has expected a value'));
if (this._done || !index && this._buffer.length > MAX_PATTERN_SIZE) {
if (index < this._buffer.length) return callback(new Error('Parser cannot parse input: expected a value'));
return callback(new Error('Parser has expected a value'));
}
break main; // wait for more input

@@ -123,0 +126,0 @@ }

@@ -113,2 +113,3 @@ # stream-json

- 1.3.3 *Bugfix: very large/infinite streams with garbage didn't fail. Thx [Arne Marschall](https://github.com/Disco1267)!*
- 1.3.2 *Bugfix: filters could fail with packed-only token streams. Thx [Trey Brisbane](https://github.com/treybrisbane)!*

@@ -115,0 +116,0 @@ - 1.3.1 *Bugfix: reverted the last bugfix in `Verifier`, a bugfix in tests, thx [Guillermo Ares](https://github.com/guillermoares).*

@@ -7,3 +7,4 @@ 'use strict';

path = require('path'),
zlib = require('zlib');
zlib = require('zlib'),
{Readable} = require('stream');

@@ -65,8 +66,8 @@ const Parser = require('../Parser');

const input = json.join(sep);
const pipeline = new ReadString(input, 4).pipe(new Parser({ jsonStreaming: true }));
const pipeline = new ReadString(input, 4).pipe(new Parser({jsonStreaming: true}));
const assembler = Assembler.connectTo(pipeline);
assembler.on('done', (asm) => {
const { current: obj } = asm;
const { n } = obj;
assembler.on('done', asm => {
const {current: obj} = asm;
const {n} = obj;
eval(t.TEST('t.unify(obj, objects[n])'));

@@ -332,3 +333,21 @@ });

new ReadString('{').pipe(stream);
},
function test_parser_infinite_fail(t) {
const async = t.startAsync('test_parser_infinite_fail');
if (!Readable.from) {
async.done();
return;
}
const sample = '{"key1":1}garbage{"key3":2}',
parser = new Parser({jsonStreaming: true, packValues: true, streamValues: false});
parser.on('error', err => {
eval(t.TEST('err'));
async.done();
});
Readable.from(
(function*() {
while(true) yield sample;
})()
).pipe(parser);
}
]);

@@ -5,2 +5,4 @@ 'use strict';

const {Readable} = require('stream');
const Verifier = require('../utils/Verifier');

@@ -138,3 +140,21 @@

});
},
function test_verifier_infinite_fail(t) {
const async = t.startAsync('test_verifier_infinite_fail');
if (!Readable.from) {
async.done();
return;
}
const sample = '{"key1":1}garbage{"key3":2}',
verifier = new Verifier({jsonStreaming: true});
verifier.on('error', err => {
eval(t.TEST('err'));
async.done();
});
Readable.from(
(function*() {
while(true) yield sample;
})()
).pipe(verifier);
}
]);

@@ -18,2 +18,3 @@ 'use strict';

};
const MAX_PATTERN_SIZE = 16;

@@ -107,4 +108,6 @@ let noSticky = true;

if (!match) {
if (index < this._buffer.length && this._done) return callback(this._makeError('Verifier cannot parse input: expected a value'));
if (this._done) return callback(this._makeError('Verifier has expected a value'));
if (this._done || !index && this._buffer.length > MAX_PATTERN_SIZE) {
if (index < this._buffer.length) return callback(this._makeError('Verifier cannot parse input: expected a value'));
return callback(this._makeError('Verifier has expected a value'));
}
break main; // wait for more input

@@ -111,0 +114,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc