Skip to content

Commit

Permalink
Remove _writev in fs-writable
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-tymoshenko committed Nov 13, 2018
1 parent 245d50e commit e5c1280
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions lib/fs-writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit e5c1280

Please sign in to comment.