Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null value is not decoded when using decode stream #93

Open
progrium opened this issue Jul 12, 2018 · 1 comment
Open

null value is not decoded when using decode stream #93

progrium opened this issue Jul 12, 2018 · 1 comment

Comments

@progrium
Copy link

progrium commented Jul 12, 2018

decoding a whole buffer works fine:

> msgpack.decode(Buffer.from([192]))
null
>

vs

> var decodeStream = msgpack.createDecodeStream();
undefined
> decodeStream.on("data", console.log);
...
> decodeStream.write(Buffer.from([192]))
true
>

The stream is then closed.

@xosg
Copy link

xosg commented Sep 11, 2019

it occured to me too, where msgpack.encode(null) works but msgpack.createEncodeStream().write(null) throws a error.

TypeError [ERR_STREAM_NULL_VALUES]: May not write null values to stream at validChunk (_stream_writable.js:261:10) at EncodeStream.Writable.write (_stream_writable.js:297:21) at Object.<anonymous> (C:\Users\jim\测试msgpack流.js:9:14) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Function.Module.runMain (internal/modules/cjs/loader.js:829:12) at startup (internal/bootstrap/node.js:283:19) Emitted 'error' event at: at errorOrDestroy (internal/streams/destroy.js:107:12) at validChunk (_stream_writable.js:266:5) at EncodeStream.Writable.write (_stream_writable.js:297:21) [... lines matching original stack trace ...] at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants