mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-06 03:50:04 +02:00
New updates and modules
This commit is contained in:
parent
4d5d408898
commit
0abf0f90f6
959 changed files with 364301 additions and 17493 deletions
34
node_modules/end-stream/index.js
generated
vendored
Normal file
34
node_modules/end-stream/index.js
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
var WriteStream = require("write-stream")
|
||||
|
||||
module.exports = EndStream
|
||||
|
||||
function EndStream(write, end) {
|
||||
var counter = 0
|
||||
, ended = false
|
||||
|
||||
end = end || noop
|
||||
|
||||
var stream = WriteStream(function (chunk) {
|
||||
counter++
|
||||
write(chunk, function (err) {
|
||||
if (err) {
|
||||
return stream.emit("error", err)
|
||||
}
|
||||
|
||||
counter--
|
||||
|
||||
if (counter === 0 && ended) {
|
||||
stream.emit("finish")
|
||||
}
|
||||
})
|
||||
}, function () {
|
||||
ended = true
|
||||
if (counter === 0) {
|
||||
this.emit("finish")
|
||||
}
|
||||
})
|
||||
|
||||
return stream
|
||||
}
|
||||
|
||||
function noop() {}
|
Loading…
Add table
Add a link
Reference in a new issue