fs-minipass
Advanced tools
Comparing version 2.0.0 to 2.0.1
27
index.js
@@ -6,8 +6,18 @@ 'use strict' | ||
// for writev | ||
const binding = process.binding('fs') | ||
const writeBuffers = binding.writeBuffers | ||
let writev = fs.writev | ||
/* istanbul ignore next */ | ||
const FSReqWrap = binding.FSReqWrap || binding.FSReqCallback | ||
if (!writev) { | ||
// This entire block can be removed if support for earlier than Node.js | ||
// 12.9.0 is not needed. | ||
const binding = process.binding('fs') | ||
const FSReqWrap = binding.FSReqWrap || binding.FSReqCallback | ||
writev = (fd, iovec, pos, cb) => { | ||
const done = (er, bw) => cb(er, bw, iovec) | ||
const req = new FSReqWrap() | ||
req.oncomplete = done | ||
binding.writeBuffers(fd, iovec, pos, req) | ||
} | ||
} | ||
const _autoClose = Symbol('_autoClose') | ||
@@ -272,3 +282,3 @@ const _close = Symbol('_close') | ||
if (typeof buf === 'string') | ||
buf = new Buffer(buf, enc) | ||
buf = Buffer.from(buf, enc) | ||
@@ -378,9 +388,2 @@ if (this[_ended]) { | ||
const writev = (fd, iovec, pos, cb) => { | ||
const done = (er, bw) => cb(er, bw, iovec) | ||
const req = new FSReqWrap() | ||
req.oncomplete = done | ||
binding.writeBuffers(fd, iovec, pos, req) | ||
} | ||
exports.ReadStream = ReadStream | ||
@@ -387,0 +390,0 @@ exports.ReadStreamSync = ReadStreamSync |
{ | ||
"name": "fs-minipass", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
13214
339
1