Class: Pipe2Jpeg

Pipe2Jpeg(optionsopt)

new Pipe2Jpeg(optionsopt)

Parameters:
Name Type Attributes Description
options object <optional>
Properties
Name Type Attributes Default Description
readableObjectMode boolean <optional>
false If true, output will be an Object instead of a Buffer.
bufferConcat boolean <optional>
false If true, concatenate Array of Buffers before output.
(readableObjectMode must be true to have any effect)
byteOffset number <optional>
200 Number of bytes to skip when searching for the EOI.
Min: 0, Max: 1000000, Default: 200
pool number <optional>
0 Experimental buffer pool
Source:

Members

byteOffset

Properties:
Name Type Description
byteOffset number - Number of bytes to skip when searching for the EOI.
- Min: 0, Max: 1000000, Default: 200.
Source:

byteOffset

Source:

(readonly) jpeg

Properties:
Name Type Description
jpeg Buffer | Null - Returns the latest JPEG as a single Buffer.
- Returns Null if readableObjectMode is true and bufferConcat is false.
- Returns Null if requested before the first JPEG is parsed from the stream.
Source:

(readonly) list

Properties:
Name Type Description
list Array | Null - Returns the latest JPEG as an Array of Buffers.
- Returns Null unless readableObjectMode is true and bufferConcat is false.
- Returns Null if requested before the first JPEG is parsed from the stream.
Source:

(readonly) poolLength

Properties:
Name Type Description
poolLength number - Returns the number of array buffers in pool
- Returns -1 if pool not in use.
Source:

(readonly) timestamp

Properties:
Name Type Description
timestamp number - Returns the timestamp of the latest JPEG as an Integer(milliseconds).
- Returns -1 if requested before the first JPEG is parsed from the stream.
Source:

(readonly) totalLength

Properties:
Name Type Description
totalLength number - Returns the total length of all the Buffers in the list.
- Returns -1 if requested before the first JPEG is parsed from the stream.
Source:

Methods

reset()

Clears internally cached values.
Source:
Fires:

toJSON() → {object}

Source:
Returns:
Type
object

Events

data

- Fires when a single JPEG is parsed from the stream.
- Event payload will be different based on setting readableObjectMode and bufferConcat in the constructor.
Type:
  • Buffer | object
Properties:
Name Type Attributes Description
list Array <optional>
see list
totalLength number <optional>
see totalLength
jpeg Buffer <optional>
see jpeg
Source:
Examples
new Pipe2Jpeg({readableObjectMode: false})
// data event payload will be a single Buffer
new Pipe2Jpeg({readableObjectMode: true, bufferConcat: false})
// data event payload will be an Object {list:Array, totalLength:number} containing an Array of Buffers and its total length
new Pipe2Jpeg({readableObjectMode: true, bufferConcat: true})
// data event payload will be an Object {jpeg:Buffer, totalLength:number} containing a single Buffer

reset

- Fires when reset is called.
Source: