How to use the pumpify function in pumpify

To help you get started, we’ve selected a few pumpify 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 sanity-io / sanity / packages / @sanity / core / src / actions / dataset / import / importDocumentsToDataset.js View on Github external
function importDocumentsToDataset(options, context, promise) {
  const {resolve, reject} = promise
  const {inputStream, targetDataset, client, operation} = options

  // Create stream that batches documents into transactions
  const mutationStream = batchedMutationStream({
    mutator: (transaction, doc) => transaction[operation](doc),
    dataset: targetDataset,
    progress: options.progress,
    batchSize: options.batchSize

  const startTime =
  const stream = pumpify(
    // Read from input stream
    // Split on each newline character and parse line as JSON
    // Make strong references weak, create reference maps so we can transform them back
    // Transform and upload assets
    // Batch into a transaction of mutations

  stream.once('error', reject)
  mutationStream.on('complete', () => resolve({timeSpent: - startTime}))


Combine an array of streams into a single duplex stream using pump and duplexify

Latest version published 5 years ago

Package Health Score

67 / 100
Full package analysis

Popular pumpify functions