pinojs / sonic-boom

Extremely fast utf8 only stream implementation
MIT License
266 stars 41 forks source link

Convert writingBuf to Buffer to compute the original string length #188

Closed unzan401 closed 10 months ago

unzan401 commented 10 months ago

Fixes #139

Although https://github.com/pinojs/sonic-boom/issues/139#issuecomment-1195160279 suggested converting this._writingBuf to a buffer, I found that it might reduce performance if we convert every this._writingBuf which just simply writes string. Therefore, I only handle cases when multi-byte characters exist.