How to use the pump.apply function in pump

To help you get started, we’ve selected a few pump examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tradle / engine / lib / indexer.js View on Github external
} else {
        updateOpts()
        stream = source.createReadStream(opts)
      }

      const pipeline = [
        // any index
        stream,
        through.obj(function (data, enc, cb) {
          if (data.type === 'del') cb()
          else cb(null, data.value) // figure out how to make it store utf8
        }),
        getEntry()
      ]

      return pump.apply(null, pipeline)

      function updateOpts () {
        utils.extend(opts, getRangeOpts(index, prop, value))
      }
    }
github Ivshti / autoupdaty / index.js View on Github external
if (!res) return next(new Error('no res'))
          if (res.statusCode !== 200) return next(new Error('downloading returned ' + res.statusCode))

          // Consider using res.headers for verifying content-length and content-disposition for saveTo

          res.on('error', next)

          res.on('data', function (d) { len += d.length; hash.update(d) })

          var pipes = [stream]
          if (update.ungzip) pipes.push(gunzip())

          if (update.untar) pipes.push(tar.extract(saveTo, { fs: fs }))
          else pipes.push(fs.createWriteStream(saveTo))

          pump.apply(null, pipes.concat([ function (err) { next(err) } ]))
        })
      },
github levelgraph / levelgraph / lib / levelgraph.js View on Github external
if (options.filter || options.offset) {
        streams.push(filterStream({
            filter: options.filter
          , offset: options.offset
        }));
      }

      if (options.materialized) {
        streams.push(materializer({
          pattern: options.materialized
        }));
      }

      streams.push(result);
      pump.apply(null, streams);
    });
github tradle / engine / lib / dbs / objects.js View on Github external
function executePipeline (pipeline) {
  return pipeline.length === 1 ? pipeline[0] : pump.apply(null, pipeline)
}

pump

pipe streams together and close all of them if one of them closes

MIT
Latest version published 6 years ago

Package Health Score

67 / 100
Full package analysis

Popular pump functions