summaryrefslogtreecommitdiff
path: root/lib/internal/fs/streams.js
diff options
context:
space:
mode:
authorRobert Nagy <ronagy@icloud.com>2019-08-17 23:36:59 +0200
committerRich Trott <rtrott@gmail.com>2019-08-19 19:00:18 -0700
commit490ec9b9c9422c8975c1613709c13f64db2f7d0f (patch)
tree0bd587c9009fc305de799c67204c859fcab34e03 /lib/internal/fs/streams.js
parent5116a6a9b4d8420149af74ac29074cd4d7f1f6b9 (diff)
downloadandroid-node-v8-490ec9b9c9422c8975c1613709c13f64db2f7d0f.tar.gz
android-node-v8-490ec9b9c9422c8975c1613709c13f64db2f7d0f.tar.bz2
android-node-v8-490ec9b9c9422c8975c1613709c13f64db2f7d0f.zip
fs: use fs.writev() internally
Avoid using internal API in fs implementation. PR-URL: https://github.com/nodejs/node/pull/29189 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'lib/internal/fs/streams.js')
-rw-r--r--lib/internal/fs/streams.js18
1 files changed, 1 insertions, 17 deletions
diff --git a/lib/internal/fs/streams.js b/lib/internal/fs/streams.js
index dfff08dbbd..87d58a8be5 100644
--- a/lib/internal/fs/streams.js
+++ b/lib/internal/fs/streams.js
@@ -3,10 +3,6 @@
const { Math, Object } = primordials;
const {
- FSReqCallback,
- writeBuffers
-} = internalBinding('fs');
-const {
ERR_INVALID_ARG_TYPE,
ERR_OUT_OF_RANGE
} = require('internal/errors').codes;
@@ -325,18 +321,6 @@ WriteStream.prototype._write = function(data, encoding, cb) {
};
-function writev(fd, chunks, position, callback) {
- function wrapper(err, written) {
- // Retain a reference to chunks so that they can't be GC'ed too soon.
- callback(err, written || 0, chunks);
- }
-
- const req = new FSReqCallback();
- req.oncomplete = wrapper;
- writeBuffers(fd, chunks, position, req);
-}
-
-
WriteStream.prototype._writev = function(data, cb) {
if (typeof this.fd !== 'number') {
return this.once('open', function() {
@@ -356,7 +340,7 @@ WriteStream.prototype._writev = function(data, cb) {
size += chunk.length;
}
- writev(this.fd, chunks, this.pos, function(er, bytes) {
+ fs.writev(this.fd, chunks, this.pos, function(er, bytes) {
if (er) {
self.destroy();
return cb(er);