Sha256: 04b7b585e056fccea011f300815d9f19afb190b7c88f5bc575aeac8b5dd00ded

Contents?: true

Size: 992 Bytes

Versions: 32

Compression:

Stored size: 992 Bytes

Contents

var pump = require('./index')

var rs = require('fs').createReadStream('/dev/random')
var ws = require('fs').createWriteStream('/dev/null')

var toHex = function () {
  var reverse = new (require('stream').Transform)()

  reverse._transform = function (chunk, enc, callback) {
    reverse.push(chunk.toString('hex'))
    callback()
  }

  return reverse
}

var wsClosed = false
var rsClosed = false
var callbackCalled = false

var check = function () {
  if (wsClosed && rsClosed && callbackCalled) {
    console.log('test-node.js passes')
    clearTimeout(timeout)
  }
}

ws.on('close', function () {
  wsClosed = true
  check()
})

rs.on('close', function () {
  rsClosed = true
  check()
})

var res = pump(rs, toHex(), toHex(), toHex(), ws, function () {
  callbackCalled = true
  check()
})

if (res !== ws) {
  throw new Error('should return last stream')
}

setTimeout(function () {
  rs.destroy()
}, 1000)

var timeout = setTimeout(function () {
  throw new Error('timeout')
}, 5000)

Version data entries

32 entries across 31 versions & 9 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/pump/test-node.js
disco_app-0.18.0 test/dummy/node_modules/pump/test-node.js
disco_app-0.18.2 test/dummy/node_modules/pump/test-node.js
disco_app-0.16.1 test/dummy/node_modules/pump/test-node.js
isomorfeus-puppetmaster-0.5.5 node_modules/pump/test-node.js
isomorfeus-puppetmaster-0.5.4 node_modules/pump/test-node.js
disco_app-0.15.2 test/dummy/node_modules/pump/test-node.js
isomorfeus-puppetmaster-0.5.3 node_modules/pump/test-node.js
disco_app-0.18.4 test/dummy/node_modules/pump/test-node.js
disco_app-0.18.1 test/dummy/node_modules/pump/test-node.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/pump/test-node.js
disco_app-0.14.0 test/dummy/node_modules/pump/test-node.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/pump/test-node.js
isomorfeus-puppetmaster-0.5.2 node_modules/pump/test-node.js
isomorfeus-puppetmaster-0.5.1 node_modules/pump/test-node.js
isomorfeus-puppetmaster-0.5.0 node_modules/pump/test-node.js
tang-0.2.1 spec/tang_app/node_modules/pump/test-node.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/pump/test-node.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/pump/test-node.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/pump/test-node.js