Socket
Socket
Sign inDemoInstall

handle-thing

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handle-thing - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

26

lib/handle.js

@@ -10,4 +10,15 @@ var assert = require('assert')

// Node.js version
var match = /^v(\d+)\.(\d+)\./.exec(process.version)
var version = match ? Number(match[1]) + Number('0.' + match[2]) : 11
var onreadMode = version >= 11.1 ? 2 : 1
var mode = 'modern'
var setNRead
if (onreadMode === 2) {
var sw = process.binding('stream_wrap')
setNRead = function (nread) {
sw.streamBaseState[sw.kReadBytesOrError] = nread
}
}
function Handle (stream, options) {

@@ -35,2 +46,11 @@ EventEmitter.call(this)

Handle.prototype._onread = function _onread (nread, buffer) {
if (onreadMode === 1) {
this.onread(nread, buffer)
} else {
setNRead(nread)
this.onread(buffer)
}
}
Handle.prototype._queueReq = function _queueReq (type, req) {

@@ -86,7 +106,7 @@ return this.pending.append(type, req)

this._stream.on('data', function (chunk) {
self.onread(chunk.length, chunk)
self._onread(chunk.length, chunk)
})
this._stream.on('end', function () {
self.onread(uv.UV_EOF, Buffer.alloc(0))
self._onread(uv.UV_EOF, Buffer.alloc(0))
})

@@ -97,3 +117,3 @@

if (self._reading) {
self.onread(uv.UV_ECONNRESET, Buffer.alloc(0))
self._onread(uv.UV_ECONNRESET, Buffer.alloc(0))
}

@@ -100,0 +120,0 @@ })

2

package.json
{
"name": "handle-thing",
"version": "2.0.0",
"version": "2.0.1",
"description": "Wrap Streams2 instance into a HandleWrap",

@@ -5,0 +5,0 @@ "main": "lib/handle.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc