Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit cf38274

Browse files
committed
.addReadableStream
1 parent a8305fb commit cf38274

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/files/add-readable-stream.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
'use strict'
22

33
const addCmd = require('./add.js')
4-
const Duplex = require('stream').Duplex
5-
const promisify = require('promisify-es6')
4+
const Duplex = require('readable-stream').Duplex
65

76
module.exports = (send) => {
87
const add = addCmd(send)
98

10-
return promisify((options, callback) => {
11-
if (typeof options === 'function') {
12-
callback = options
13-
options = undefined
14-
}
9+
return (options) => {
10+
options = options || {}
1511

1612
const tuples = []
1713

@@ -23,13 +19,13 @@ module.exports = (send) => {
2319
next()
2420
}
2521

26-
ds.end = () => {
27-
add(tuples, options, (err, res) => {
28-
if (err) { return ds.emit('error', err) }
29-
res.forEach((tuple) => ds.push(tuple))
30-
ds.push(null)
31-
})
32-
}
33-
callback(null, ds)
34-
})
22+
ds.end = () => add(tuples, options, (err, res) => {
23+
if (err) { return ds.emit('error', err) }
24+
25+
res.forEach((tuple) => ds.push(tuple))
26+
ds.push(null)
27+
})
28+
29+
return ds
30+
}
3531
}

0 commit comments

Comments
 (0)