@nxtedition/lib 23.10.3 → 23.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/couch.js +11 -4
- package/package.json +1 -1
package/couch.js
CHANGED
|
@@ -296,8 +296,6 @@ export function makeCouch(opts) {
|
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
src.setEncoding('utf8')
|
|
300
|
-
|
|
301
299
|
src
|
|
302
300
|
.on('readable', maybeResume)
|
|
303
301
|
.on('error', (err) => {
|
|
@@ -310,12 +308,21 @@ export function makeCouch(opts) {
|
|
|
310
308
|
})
|
|
311
309
|
.on('close', maybeResume)
|
|
312
310
|
|
|
311
|
+
const decoder = new TextDecoder('utf-8')
|
|
313
312
|
let str = ''
|
|
314
313
|
while (true) {
|
|
315
314
|
const chunk = src.read()
|
|
316
315
|
|
|
317
|
-
|
|
318
|
-
|
|
316
|
+
let text = null
|
|
317
|
+
if (chunk != null) {
|
|
318
|
+
text = decoder.decode(chunk, { stream: true })
|
|
319
|
+
} else if (ended) {
|
|
320
|
+
text = decoder.decode() || null
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (text != null) {
|
|
324
|
+
const lines = (str + text).split(/\r?\n/)
|
|
325
|
+
|
|
319
326
|
str = lines.pop() ?? ''
|
|
320
327
|
|
|
321
328
|
for (const line of lines) {
|