From e5c1280a60a6ca8e3dbe3560b3500987414b8f6c Mon Sep 17 00:00:00 2001 From: bugagashenkj Date: Tue, 13 Nov 2018 15:47:07 +0200 Subject: [PATCH] Remove _writev in fs-writable --- lib/fs-writable.js | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/lib/fs-writable.js b/lib/fs-writable.js index fd79e0a..7052658 100644 --- a/lib/fs-writable.js +++ b/lib/fs-writable.js @@ -27,16 +27,6 @@ const { ERR_OUT_OF_RANGE } = require('./errors'); -const { FSReqCallback, writeBuffers } = process.binding('fs'); - -const writev = (fd, chunks, position, callback) => { - const wrapper = (err, written) => { callback(err, written || 0, chunks); }; - - const req = new FSReqCallback(); - req.oncomplete = wrapper; - writeBuffers(fd, chunks, position, req); -}; - const closeFsStream = (stream, cb, err) => { fs.close(stream.fd, (er) => { er = er || err; @@ -124,35 +114,6 @@ class WriteStream extends Writable { } - _writev(data, cb) { - if (typeof this.fd !== 'number') { - return this.once('open', () => { this._writev(data, cb); }); - } - - const self = this; - const len = data.length; - const chunks = new Array(len); - let size = 0; - - for (let i = 0; i < len; i++) { - const chunk = data[i]; - - chunks[i] = chunk; - size += chunk.length; - } - - writev(this.fd, chunks, this.pos, (er, bytes) => { - if (er) { - self.destroy(); - return cb(er); - } - self.bytesWritten += bytes; - cb(); - }); - - if (this.pos !== undefined) this.pos += size; - } - close(cb) { if (cb) { if (this.closed) {