Skip to content

Commit

Permalink
fix: migrate to streamx (#173)
Browse files Browse the repository at this point in the history
* fix: migrate to streamx

* chore: dump readable-stream dep
  • Loading branch information
ThaUnknown authored Sep 2, 2022
1 parent 02cd503 commit 40a0f50
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const once = require('once')
const parallel = require('run-parallel')
const queueMicrotask = require('queue-microtask')
const sha1 = require('simple-sha1')
const stream = require('readable-stream')
const { Transform, PassThrough } = require('streamx')

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

Expand Down Expand Up @@ -424,7 +424,7 @@ function getBlobStream (file) {
*/
function getBufferStream (buffer) {
return () => {
const s = new stream.PassThrough()
const s = new PassThrough()
s.end(buffer)
return s
}
Expand All @@ -440,11 +440,11 @@ function getBufferStream (buffer) {
*/
function getStreamStream (readable, file) {
return () => {
const counter = new stream.Transform()
counter._transform = function (buf, enc, done) {
file.length += buf.length
this.push(buf)
done()
const counter = new Transform()
counter._transform = function (data, cb) {
file.length += data.length
this.push(data)
cb()
}
readable.pipe(counter)
return counter
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"once": "^1.4.0",
"piece-length": "^2.0.1",
"queue-microtask": "^1.2.3",
"readable-stream": "^3.6.0",
"run-parallel": "^1.2.0",
"simple-sha1": "^3.1.0"
"simple-sha1": "^3.1.0",
"streamx": "^2.12.4"
},
"devDependencies": {
"@webtorrent/semantic-release-config": "1.0.7",
Expand Down

0 comments on commit 40a0f50

Please sign in to comment.