Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d79d142

Browse filesBrowse files
ronagtargos
authored andcommitted
fs: use fs.writev() internally
Avoid using internal API in fs implementation. PR-URL: #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>
1 parent c4f6077 commit d79d142
Copy full SHA for d79d142

File tree

Expand file treeCollapse file tree

1 file changed

+1
-17
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-17
lines changed
Open diff view settings
Collapse file

‎lib/internal/fs/streams.js‎

Copy file name to clipboardExpand all lines: lib/internal/fs/streams.js
+1-17Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
const { Math, Object } = primordials;
44

5-
const {
6-
FSReqCallback,
7-
writeBuffers
8-
} = internalBinding('fs');
95
const {
106
ERR_INVALID_ARG_TYPE,
117
ERR_OUT_OF_RANGE
@@ -325,18 +321,6 @@ WriteStream.prototype._write = function(data, encoding, cb) {
325321
};
326322

327323

328-
function writev(fd, chunks, position, callback) {
329-
function wrapper(err, written) {
330-
// Retain a reference to chunks so that they can't be GC'ed too soon.
331-
callback(err, written || 0, chunks);
332-
}
333-
334-
const req = new FSReqCallback();
335-
req.oncomplete = wrapper;
336-
writeBuffers(fd, chunks, position, req);
337-
}
338-
339-
340324
WriteStream.prototype._writev = function(data, cb) {
341325
if (typeof this.fd !== 'number') {
342326
return this.once('open', function() {
@@ -356,7 +340,7 @@ WriteStream.prototype._writev = function(data, cb) {
356340
size += chunk.length;
357341
}
358342

359-
writev(this.fd, chunks, this.pos, function(er, bytes) {
343+
fs.writev(this.fd, chunks, this.pos, function(er, bytes) {
360344
if (er) {
361345
self.destroy();
362346
return cb(er);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.