pamelafox / ndjson-readablestream

A small JS package for reading a ReadableStream of NDJSON
MIT License
9 stars 4 forks source link

added stream option in decode #1

Closed yoshiki-maruya closed 10 months ago

yoshiki-maruya commented 10 months ago

Purpose

To add the stream option to True when decoding. Failure to specify this option may cause garbled characters as shown below.

あ���がとう

This matter sometimes seems to occur with multibyte characters. Also, performance can be improved by not creating a TextDecoder instance within the while.

Does this introduce a breaking change?

[ ] Yes
[x] No

Pull Request Type

What kind of change does this Pull Request introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

Run node test.mjs command

node test.mjs

What to Check

pamelafox commented 10 months ago

Great, thank you!