How to use first-chunk-stream - 2 common examples

To help you get started, we’ve selected a few first-chunk-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 mozilla / addons-linter / src / io / directory.js View on Github external
return new Promise((resolve) => {
      createReadStream(filePath, {
        flags: 'r',
        // This is important because you don't want to encode the
        // bytes if you are doing a binary check.
        encoding: null,
        autoClose: true,
      }).pipe(
        new FirstChunkStream({ chunkLength }, (_, enc) => {
          resolve(enc);
        })
      );
    });
  }
github mozilla / addons-linter / src / io / xpi.js View on Github external
zipfile.openReadStream(this.files[path], (err, readStream) => {
        if (err) {
          reject(err);
          return;
        }
        readStream.pipe(
          new FirstChunkStream({ chunkLength }, (_, enc) => {
            resolve(enc);
          })
        );
      });
    });

first-chunk-stream

Buffer and transform the n first bytes of a stream

MIT
Latest version published 1 year ago

Package Health Score

67 / 100
Full package analysis

Popular first-chunk-stream functions