How to use the seek-bzip.decode function in seek-bzip

To help you get started, we’ve selected a few seek-bzip 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 openpgpjs / openpgpjs / src / packet / compressed.js View on Github external
return stream.fromAsync(async () => func(await stream.readToEnd(data)));
  };
}

let compress_fns;
let decompress_fns;
if (nodeZlib) { // Use Node native zlib for DEFLATE compression/decompression
  compress_fns = {
    zip: node_zlib(nodeZlib.createDeflateRaw, { level: config.deflate_level }),
    zlib: node_zlib(nodeZlib.createDeflate, { level: config.deflate_level })
  };

  decompress_fns = {
    zip: node_zlib(nodeZlib.createInflateRaw),
    zlib: node_zlib(nodeZlib.createInflate),
    bzip2: bzip2(Bunzip.decode)
  };
} else { // Use JS fallbacks
  compress_fns = {
    zip: pako_zlib(pako.Deflate, { raw: true, level: config.deflate_level }),
    zlib: pako_zlib(pako.Deflate, { level: config.deflate_level })
  };

  decompress_fns = {
    zip: pako_zlib(pako.Inflate, { raw: true }),
    zlib: pako_zlib(pako.Inflate),
    bzip2: bzip2(Bunzip.decode)
  };
}
github sx1989827 / DOClever / Desktop / node_modules / decompress-tarbz2 / index.js View on Github external
module.exports = () => input => {
	if (!Buffer.isBuffer(input) && !isStream(input)) {
		return Promise.reject(new TypeError(`Expected a Buffer or Stream, got ${typeof input}`));
	}

	if (Buffer.isBuffer(input) && (!fileType(input) || fileType(input).ext !== 'bz2')) {
		return Promise.resolve([]);
	}

	if (Buffer.isBuffer(input)) {
		return decompressTar()(seekBzip.decode(input));
	}

	return decompressTar()(input.pipe(unbzip2Stream()));
};

seek-bzip

a pure-JavaScript Node.JS module for random-access decoding bzip2 data

MIT
Latest version published 4 years ago

Package Health Score

65 / 100
Full package analysis

Popular seek-bzip functions