How to use the concat-stream function in concat-stream

To help you get started, we’ve selected a few concat-stream 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 beakerbrowser / beaker / app / bg / logger.js View on Github external
return new Promise((resolve, reject) => {
    opts.limit = opts.limit || 100
    var readFn = opts.sort === 'desc' ? fsReverse : fs.createReadStream
    var readStream = readFn(getLogPath(opts.logFile || 0), {encoding: 'utf8'})
    const nosplit = (readFn === fsReverse) // fs-reverse splits for us
    pump(
      readPipeline(readStream, opts, nosplit),
      concat({encoding: 'object'}, res => resolve(/** @type any */(res))),
      reject
    )
  })
}
github SassDoc / sassdoc / src / parser.js View on Github external
})
      }

      let parseError = false;
      try {
        if (file.isBuffer()) {
          let args = {
            buf: file.contents,
            name: path.basename(file.relative),
            path: file.relative,
          }
          parseFile(args)
        }

        if (file.isStream()) {
          file.pipe(concat(buf => {
            parseFile({ buf })
          }))
        }
      } catch (error) {
        parseError = true;
        cb(error);
      }

      // Pass-through.
      if (!parseError) {
        cb(null, file)
      }
    }
github cypress-io / cypress / packages / net-stubbing / lib / server / intercept-request.ts View on Github external
}

  if (route.staticResponse) {
    emitReceived()
    sendStaticResponse(request.res, route.staticResponse, request.onResponse!)

    return // don't call cb since we've satisfied the response here
  }

  // if we already have a body, just emit
  if (frame.req.body) {
    return emitReceived()
  }

  // else, buffer the body
  request.req.pipe(concatStream((reqBody) => {
    frame.req.body = reqBody.toString()
    emitReceived()
  }))
}
github beakerbrowser / beaker / app / background-process / networks / dat / library.js View on Github external
return new Promise((resolve, reject) => {
    let rs = debugLogFile.createReadStream()
    rs
      .pipe(split())
      .pipe(through({encoding: 'utf8', decodeStrings: false}, (data, _, cb) => {
        if (data && data.startsWith(key)) {
          return cb(null, data.slice(key.length) + '\n')
        }
        cb()
      }))
      .pipe(concat({encoding: 'string'}, resolve))
    rs.on('error', reject)
  })
}
github beakerbrowser / beaker / app / background-process / web-apis / dat-archive.js View on Github external
return new Promise((resolve, reject) => {
        var stream = checkoutFS.history({live: false, start, end})
        stream.pipe(concat({encoding: 'object'}, values => {
          values = values.map(massageHistoryObj)
          if (reverse) values.reverse()
          resolve(values)
        }))
        stream.on('error', reject)
      })
    })
github minio / minio-js / src / main / upload.js View on Github external
var request = transport.request(requestParams, (response) => {
      if (response.statusCode !== 200) {
        return parseError(response, cb)
      }
      response.pipe(Concat(xml => {
        var parsedXml = ParseXml(xml.toString()),
          uploadId = null
        parsedXml.root.children.forEach(element => {
          if (element.name === 'UploadId') {
            uploadId = element.content
          }
        })

        if (uploadId) {
          return cb(null, uploadId)
        }
        cb('unable to get upload id')
      }))
    })
    request.end()
github expo / expo-cli / packages / xdl / src / TurtleApi.ts View on Github external
return new Promise(resolve => {
      formData.pipe(concat({ encoding: 'buffer' }, data => resolve({ data })));
    });
  }
github beakerbrowser / beaker / app / background-process / analytics.js View on Github external
}, (res) => {
      if (res.statusCode === 204) {
        debug('Ping succeeded')
        resolve()
      } else {
        res.setEncoding('utf8')
        res.pipe(concat(body => debug('Ping failed', res.statusCode, body)))
        reject()
      }
    })
    req.on('error', err => {
github tec27 / seatcamp / lib / frame-converter.js View on Github external
return new Promise((resolve, reject) => {
    const readStream = fs.createReadStream(`${folder}${sep}vid${vidExtension}`)
    readStream.on('error', reject)

    readStream.pipe(concat(resolve)).on('error', reject)
  })
}
github expo / expo-cli / packages / xdl / src / Api.ts View on Github external
return new Promise(resolve => {
    formData.pipe(concat({ encoding: 'buffer' }, data => resolve({ data })));
  });
}

concat-stream

writable stream that concatenates strings or binary data and calls a callback with the result

MIT
Latest version published 6 years ago

Package Health Score

74 / 100
Full package analysis