new Pipe2Jpeg(optionsopt)
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
Properties
|
Members
byteOffset
Properties:
Name | Type | Description |
---|---|---|
byteOffset |
number | - Number of bytes to skip when searching for the EOI.
- Min: 0, Max: 1000000, Default: 200. |
byteOffset
(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. |
(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. |
(readonly) poolLength
Properties:
Name | Type | Description |
---|---|---|
poolLength |
number | - Returns the number of array buffers in pool
- Returns -1 if pool not in use. |
(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. |
(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. |
Methods
reset()
Clears internally cached values.
Fires:
toJSON() → {object}
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.
- 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 |
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.