Skip to content

Commit 40a0f50

Browse files
authored
fix: migrate to streamx (#173)
* fix: migrate to streamx * chore: dump readable-stream dep
1 parent 02cd503 commit 40a0f50

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const once = require('once')
1111
const parallel = require('run-parallel')
1212
const queueMicrotask = require('queue-microtask')
1313
const sha1 = require('simple-sha1')
14-
const stream = require('readable-stream')
14+
const { Transform, PassThrough } = require('streamx')
1515

1616
const getFiles = require('./get-files') // browser exclude
1717

@@ -424,7 +424,7 @@ function getBlobStream (file) {
424424
*/
425425
function getBufferStream (buffer) {
426426
return () => {
427-
const s = new stream.PassThrough()
427+
const s = new PassThrough()
428428
s.end(buffer)
429429
return s
430430
}
@@ -440,11 +440,11 @@ function getBufferStream (buffer) {
440440
*/
441441
function getStreamStream (readable, file) {
442442
return () => {
443-
const counter = new stream.Transform()
444-
counter._transform = function (buf, enc, done) {
445-
file.length += buf.length
446-
this.push(buf)
447-
done()
443+
const counter = new Transform()
444+
counter._transform = function (data, cb) {
445+
file.length += data.length
446+
this.push(data)
447+
cb()
448448
}
449449
readable.pipe(counter)
450450
return counter

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
"once": "^1.4.0",
2929
"piece-length": "^2.0.1",
3030
"queue-microtask": "^1.2.3",
31-
"readable-stream": "^3.6.0",
3231
"run-parallel": "^1.2.0",
33-
"simple-sha1": "^3.1.0"
32+
"simple-sha1": "^3.1.0",
33+
"streamx": "^2.12.4"
3434
},
3535
"devDependencies": {
3636
"@webtorrent/semantic-release-config": "1.0.7",

0 commit comments

Comments
 (0)