npm.io
1.0.1 • Published 5 years ago

lz4-offset-stream

Licence
MIT
Version
1.0.1
Deps
0
Size
7 kB
Vulns
0
Weekly
0
Stars
1

lz4-offset-stream

Node.js stream that emits lz4 segment offsets

Ever wanted to try and recover a file containing lz4 segments? If so, this is for you. This is a node Transform stream that emits data events. The argument emitted in the data event is a number, which is the start offset of a lz4 segment.

Install

$ npm install [--save] lz4-offset-stream

Tests

$ npm test

Usage

'use strict'

const stream = require('stream')
const fs = require('fs')
const OffsetStream = require('lz4-offset-stream')

const start = process.env.OFFSET
  ? +process.env.OFFSET
  : 0

const fd = fs.createWriteStream('./file', {start})
const decoder = new OffsetStream({start})
pipeline(fd, decoder, process.stdout, (err) => {
  console.log('done', err)
})

License

SEE LICENSE IN LICENSE

Author

Evan Lucas