import WARCStreamTransform from 'node-warc/lib/parsers/warcStreamTransform.js'
WARCStreamTransform
Extends:
Transform → WARCStreamTransform
Transforms a WARC file ReadStream into its individual WARCRecords
Example:
fs.createReadStream('someWARC.warc')
.pipe(new WARCStreamTransform())
.on('data', record => { console.log(record) })
fs.createReadStream('someWARC.warc.gz')
.pipe(zlib.createGunzip())
.pipe(new WARCStreamTransform())
.on('data', record => { console.log(record) })
Constructor Summary
Public Constructor | ||
public |
Create a new WARCStreamTransform |
Member Summary
Public Members | ||
public |
|
|
public |
|
|
public |
|
Method Summary
Private Methods | ||
private |
_consumeChunk(chunk: Buffer, done: function, pushLast: boolean) Process the supplied chunk |
|
private |
Flushes any remaining data |
|
private |
_transform(buf: Buffer, enc: string, done: function) Process a chunk |
Public Constructors
Public Members
public builder: RecordBuilder source
Private Methods
private _consumeChunk(chunk: Buffer, done: function, pushLast: boolean) source
Process the supplied chunk
Params:
Name | Type | Attribute | Description |
chunk | Buffer | The chunk to be processed |
|
done | function | Function used to indicate we are done processing the chunk |
|
pushLast | boolean |
|
Boolean indicating if we attempt to build a record and push it once we are done processing the chunk IFF a record was built. Is only true when called from _flush |