Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

duplexify

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

duplexify - npm Package Compare versions

Comparing version 1.5.1 to 1.5.2

25

index.js

@@ -7,2 +7,4 @@ var eos = require('end-of-stream')

var TEST_BUFFER_PLEASE_IGNORE = new Buffer(0)
var onclose = function(self) {

@@ -181,3 +183,4 @@ return function(err) {

if (data) this._writable.write(data)
if (data) this.write(data)
if (!cb) cb = noop

@@ -189,11 +192,18 @@ var self = this

if (!this._writable._writableState) {
self._writable.end()
end()
return
}
this._flush(function(err) {
if (err) return cb(err)
self._writable.end(end)
if (!self._writable._writableState) {
self._writable.end()
return end()
}
self._writable.end(end)
})
}
Duplexify.prototype._flush = function(cb) {
this.write(TEST_BUFFER_PLEASE_IGNORE, null, cb)
}
Duplexify.prototype._write = function(data, enc, cb) {

@@ -207,2 +217,3 @@ if (this.destroyed) return cb()

if (data === TEST_BUFFER_PLEASE_IGNORE) return cb()
if (this._writable.write(data) === false) this._ondrain = cb

@@ -209,0 +220,0 @@ else cb()

{
"name": "duplexify",
"version": "1.5.1",
"version": "1.5.2",
"description": "Turn a writeable and readable stream into a streams2 duplex stream with support for async initialization and streams1/streams2 input",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -21,2 +21,25 @@ var tape = require('tape')

tape('async passthrough + end', function(t) {
t.plan(2)
var pt = through.obj({highWaterMark:1}, function(data, enc, cb) {
setTimeout(function() {
cb(null, data)
}, 100)
})
var dup = duplexify(pt, pt)
dup.write('hello ')
dup.write('world')
dup.end()
dup.on('finish', function() {
t.ok(true, 'should finish')
})
dup.pipe(concat(function(data) {
t.same(data.toString(), 'hello world', 'same in as out')
}))
})
tape('duplex', function(t) {

@@ -23,0 +46,0 @@ var readExpected = ['read-a', 'read-b', 'read-c']

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