How to use the readable-stream.Stream function in readable-stream

To help you get started, we’ve selected a few readable-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 winstonjs / winston / lib / winston / logger.js View on Github external
stream(options = {}) {
    const out = new Stream();
    const streams = [];

    out._streams = streams;
    out.destroy = () => {
      let i = streams.length;
      while (i--) {
        streams[i].destroy();
      }
    };

    // Create a list of all transports for this instance.
    this.transports
      .filter(transport => !!transport.stream)
      .forEach(transport => {
        const str = transport.stream(options);
        if (!str) {
github gulpjs / vinyl / test / inspectStream.js View on Github external
it('should work on a core Stream', function(done) {
    var testStream = new Stream.Stream();
    inspectStream(testStream).should.equal('');
    done();
  });
github winstonjs / winston / lib / winston / transports / file.js View on Github external
stream(options = {}) {
    const file = path.join(this.dirname, this.filename);
    const stream = new Stream();
    const tail = {
      file,
      start: options.start
    };

    stream.destroy = tailFile(tail, (err, line) => {
      if (err) {
        return stream.emit('error', err);
      }

      try {
        stream.emit('data', line);
        line = JSON.parse(line);
        stream.emit('log', line);
      } catch (e) {
        stream.emit('error', e);
github beakerbrowser / beaker-core / lib / tail-file.js View on Github external
module.exports = (file) => {
  const buffer = Buffer.alloc(64 * 1024)
  const decode = new StringDecoder('utf8')
  const stream = new Stream()
  let pos = 0

  stream.readable = true
  stream.destroy = () => {
    stream.destroyed = true
    stream.emit('end')
    stream.emit('close')
  }

  fs.open(file, 'a+', '0644', async (err, fd) => {
    if (err) {
      stream.emit('error', err)
      stream.destroy()
      return
    }
github winstonjs / winston / lib / winston / tail-file.js View on Github external
module.exports = (options, iter) => {
  const buffer = Buffer.alloc(64 * 1024);
  const decode = new StringDecoder('utf8');
  const stream = new Stream();
  let buff = '';
  let pos = 0;
  let row = 0;

  if (options.start === -1) {
    delete options.start;
  }

  stream.readable = true;
  stream.destroy = () => {
    stream.destroyed = true;
    stream.emit('end');
    stream.emit('close');
  };

  fs.open(options.file, 'a+', '0644', (err, fd) => {
github winstonjs / winston / lib / winston / transports / http.js View on Github external
stream(options = {}) {
    const stream = new Stream();
    options = {
      method: 'stream',
      params: options
    };

    if (options.params.path) {
      options.path = options.params.path;
      delete options.params.path;
    }

    if (options.params.auth) {
      options.auth = options.params.auth;
      delete options.params.auth;
    }

    let buff = '';
github aws-samples / aws-xray-kubernetes-serverless / lambda / node_modules / winston / lib / winston / transports / http.js View on Github external
stream(options = {}) {
    const stream = new Stream();
    options = {
      method: 'stream',
      params: options
    };

    if (options.params.path) {
      options.path = options.params.path;
      delete options.params.path;
    }

    if (options.params.auth) {
      options.auth = options.params.auth;
      delete options.params.auth;
    }

    let buff = '';