From d2b40653c4082313e84be90ffc9ad64c2817cf9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Isager=20Dalsgar=C3=B0?= Date: Fri, 31 May 2024 14:12:53 +0200 Subject: [PATCH] Update `bare-stream` --- index.js | 8 ++------ package.json | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 5dd9653..b35b636 100644 --- a/index.js +++ b/index.js @@ -17,7 +17,7 @@ const constants = exports.constants = { const Socket = exports.Socket = class NetSocket extends Duplex { constructor (opts = {}) { - super({ mapWritable, eagerOpen: true }) + super({ eagerOpen: true }) const { readBufferSize = defaultReadBufferSize, @@ -105,7 +105,7 @@ const Socket = exports.Socket = class NetSocket extends Duplex { return this } - _write (data, cb) { + _write (data, encoding, cb) { if (this._socket !== null && this._socket.write(data)) cb(null) else this._pendingWrite = cb } @@ -316,7 +316,3 @@ exports.createConnection = function createConnection (...args) { exports.createServer = function createServer (opts, onconnection) { return new Server(opts, onconnection) } - -function mapWritable (buf) { - return typeof buf === 'string' ? Buffer.from(buf) : buf -} diff --git a/package.json b/package.json index a0702a0..2a7b99a 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "dependencies": { "bare-events": "^2.2.2", "bare-pipe": "^3.2.0", - "bare-stream": "^1.0.0", + "bare-stream": "^2.0.0", "bare-tcp": "^1.4.0" }, "devDependencies": {