jbenet / jbenet/node-ubjson-stream

Problem with a standard JSON file.

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
3
Forks
1
PR merge metrics
No merged PRs in 30d

Description

I tried to encode a sample JSON file I use for testing, and `ubjson` blew up on me:

```bash
$ npx ubjson -e < sample.json > sample.ubj
events.js:167
throw er; // Unhandled 'error' event
^

TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be one of type string or Buffer. Received type object
at validChunk (_stream_writable.js:258:10)
at WriteStream.Writable.write (_stream_writable.js:292:21)
at die (/Users/elazutkin/Work/sjson/node_modules/ubjson-stream/bin.js:102:18)
at /Users/elazutkin/Work/sjson/node_modules/ubjson-stream/bin.js:65:18
at Object.encode (/Users/elazutkin/Work/sjson/node_modules/ubjson-stream/index.js:48:14)
at /Users/elazutkin/Work/sjson/node_modules/ubjson-stream/bin.js:64:20
at ConcatStream. (/Users/elazutkin/Work/sjson/node_modules/concat-stream/index.js:37:43)
at ConcatStream.emit (events.js:187:15)
at finishMaybe (/Users/elazutkin/Work/sjson/node_modules/readable-stream/lib/_stream_writable.js:630:14)
at endWritable (/Users/elazutkin/Work/sjson/node_modules/readable-stream/lib/_stream_writable.js:638:3)
Emitted 'error' event at:
at validChunk (_stream_writable.js:261:12)
at WriteStream.Writable.write (_stream_writable.js:292:21)
[... lines matching original stack trace ...]
at endWritable (/Users/elazutkin/Work/sjson/node_modules/readable-stream/lib/_stream_writable.js:638:3)
```

You can find the gzipped test file here: https://github.com/uhop/stream-json/blob/master/tests/sample.json.gz

PS: The file is totally valid JSON, and can be parsed by `JSON.parse()` as you can see from the trace — the error has happened after parsing.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.