Skip to content

Commit e7b2298

Browse files
committed
Handle smaller chunks
1 parent 5f6d384 commit e7b2298

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,16 @@ function Db(file, opts) {
6464
return setImmediate(_done)
6565
}
6666
if (buf[0] === 10 && buf.length === 1) return
67+
if (bufs.length > 0) {
68+
buf = Buffer.concat([bufs[0], buf])
69+
len = buf.length
70+
bufs.length = 0
71+
}
6772
i = cut = buf.indexOf(10) + 1
73+
if (i < 1) {
74+
bufs[0] = buf
75+
return
76+
}
6877
db.headers = buf.toString("utf8", 1, i - 2).split("','")
6978
} else if (type === 9) {
7079
type = 8

0 commit comments

Comments
 (0)