Skip to content

Commit 190f920

Browse files
committed
Use autoDestroy option
Category: change Closes: #13
1 parent fc4fb51 commit 190f920

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class LevelReadStream extends Readable {
1414

1515
super({
1616
objectMode: true,
17+
autoDestroy: true,
1718
highWaterMark: highWaterMark || 1000
1819
})
1920

@@ -26,9 +27,6 @@ class LevelReadStream extends Readable {
2627
// support callbacks anymore. Version 1 does also support promises but
2728
// that would be slower because it works by wrapping the callback API.
2829
this[kPromises] = db.hooks !== undefined
29-
30-
// NOTE: use autoDestroy option when it lands in readable-stream
31-
this.once('end', this.destroy.bind(this, null, null))
3230
}
3331

3432
get db () {

test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ for (const Ctor of [EntryStream, KeyStream, ValueStream]) {
6262
const stream = new Ctor(db)
6363

6464
const order = monitor(stream, function () {
65-
t.same(order.filter(withoutDataEvents), ['_close', 'end', 'close'])
65+
t.same(order.filter(withoutDataEvents), ['end', '_close', 'close'])
6666
t.end()
6767
})
6868

0 commit comments

Comments
 (0)