Submit
Path:
~
/
/
usr
/
local
/
lib
/
node_modules
/
npm
/
node_modules
/
JSONStream
/
node_modules
/
jsonparse
/
test
/
File Content:
big-token.js
var stream = require('stream'); var JsonParse = require('../jsonparse'); var test = require('tape'); test('can handle large tokens without running out of memory', function (t) { var parser = new JsonParse(); var chunkSize = 1024; var chunks = 1024 * 200; // 200mb var quote = Buffer.from ? Buffer.from('"') : new Buffer('"'); t.plan(1); parser.onToken = function (type, value) { t.equal(value.length, chunkSize * chunks, 'token should be size of input json'); t.end(); }; parser.write(quote); for (var i = 0; i < chunks; ++i) { var buf = Buffer.alloc ? Buffer.alloc(chunkSize) : new Buffer(chunkSize); buf.fill('a'); parser.write(buf); } parser.write(quote); });
Submit
FILE
FOLDER
Name
Size
Permission
Action
big-token.js
708 bytes
0644
boundary.js
2777 bytes
0644
offset.js
1715 bytes
0644
primitives.js
1240 bytes
0644
surrogate.js
451 bytes
0644
unvalid.js
251 bytes
0644
utf8.js
705 bytes
0644
N4ST4R_ID | Naxtarrr