Skip to content
Tyler Kellen edited this page Jan 30, 2014 · 20 revisions

A virtual file format

A Record is a representation of some form of input, typically a file, whose contents are stored in an underlying buffer or stream. Records are passed between Tasks, allowing unlimited in-memory transformations before being written to their final destination. A valid Record instance must include the following properties and methods. The canonical implementation is node-record.

path

A string property identifying the source of a record.

contents

The content of the record. Can be a Buffer, a Stream, or null.

encoding

String property containing an optional default encoding for Buffer-backed Records.

toString(encoding)

For usage with Buffer backed records only. Calls toString() on the underlying buffer. If no encoding is provided, the Record's optional encoding property will be used. If neither is available, will default to utf8 encoding.

isNull()

Return true if the record contents are null.

isBuffer()

Return true if the record contents are a Buffer.

isStream()

Return true if the record contents are a Stream.

clone()

Return a clone of the record.

pipe(stream[, opt])

  • If the record contents are a Buffer, it will be written to the provided stream.
  • If the record contents are a Stream, pipe them to the provided stream.
  • If the record contents are null, this will do nothing.
  • If opt.end is true, the destination stream will not be ended.

Returns the provided stream.

Clone this wiki locally