mirror of
https://github.com/electron/node-gyp.git
synced 2025-09-17 06:23:39 +02:00
update "fstream" to v0.1.22
This commit is contained in:
parent
69da815c6f
commit
bdacb6a5b8
5 changed files with 26 additions and 22 deletions
5
node_modules/fstream/lib/file-writer.js
generated
vendored
5
node_modules/fstream/lib/file-writer.js
generated
vendored
|
@ -36,12 +36,15 @@ FileWriter.prototype._create = function () {
|
|||
me._stream = fs.createWriteStream(me._path, so)
|
||||
|
||||
me._stream.on("open", function (fd) {
|
||||
// console.error("FW open", me._buffer, me._path)
|
||||
me.ready = true
|
||||
me._buffer.forEach(function (c) {
|
||||
if (c === EOF) me._stream.end()
|
||||
else me._stream.write(c)
|
||||
})
|
||||
me.emit("ready")
|
||||
// give this a kick just in case it needs it.
|
||||
me.emit("drain")
|
||||
})
|
||||
|
||||
me._stream.on("drain", function () { me.emit("drain") })
|
||||
|
@ -58,6 +61,8 @@ FileWriter.prototype.write = function (c) {
|
|||
me._bytesWritten += c.length
|
||||
|
||||
if (!me.ready) {
|
||||
if (!Buffer.isBuffer(c) && typeof c !== 'string')
|
||||
throw new Error('invalid write data')
|
||||
me._buffer.push(c)
|
||||
return false
|
||||
}
|
||||
|
|
4
node_modules/fstream/lib/proxy-writer.js
generated
vendored
4
node_modules/fstream/lib/proxy-writer.js
generated
vendored
|
@ -71,7 +71,7 @@ ProxyWriter.prototype._addProxy = function (proxy) {
|
|||
var calls = me._buffer
|
||||
calls.forEach(function (c) {
|
||||
// console.error("~~ ~~ proxy buffered call", c[0], c[1])
|
||||
proxy[c[0]].call(proxy, c[1])
|
||||
proxy[c[0]].apply(proxy, c[1])
|
||||
})
|
||||
me._buffer.length = 0
|
||||
if (me._needsDrain) me.emit("drain")
|
||||
|
@ -102,7 +102,7 @@ ProxyWriter.prototype.write = function (c) {
|
|||
ProxyWriter.prototype.end = function (c) {
|
||||
// console.error("~~ proxy end")
|
||||
if (!this._proxy) {
|
||||
this._buffer.push(["end", c])
|
||||
this._buffer.push(["end", [c]])
|
||||
return false
|
||||
}
|
||||
return this._proxy.end(c)
|
||||
|
|
5
node_modules/fstream/lib/writer.js
generated
vendored
5
node_modules/fstream/lib/writer.js
generated
vendored
|
@ -290,13 +290,13 @@ Writer.prototype._finish = function () {
|
|||
return
|
||||
|
||||
function setProps (current) {
|
||||
todo += 3
|
||||
endChmod(me, me.props, current, me._path, next("chmod"))
|
||||
endChown(me, me.props, current, me._path, next("chown"))
|
||||
endUtimes(me, me.props, current, me._path, next("chown"))
|
||||
endUtimes(me, me.props, current, me._path, next("utimes"))
|
||||
}
|
||||
|
||||
function next (what) {
|
||||
todo ++
|
||||
return function (er) {
|
||||
// console.error(" W Finish", what, todo)
|
||||
if (errState) return
|
||||
|
@ -387,4 +387,3 @@ function objectToString (d) {
|
|||
function isDate(d) {
|
||||
return typeof d === 'object' && objectToString(d) === '[object Date]';
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue