- Source:
Requires
Methods
(static) default(file, optionsopt) → {Promise.<{chunks: Array.<Chunk>, chunksByType: Array.<{type:number, chunks:Array.<Chunk>}>}>|null}
Parse a PNG file and return its data chunks
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
file |
PathLike | FileHandle | PNG file |
||||||||||||||||||||||||||
options |
Object |
<optional> |
Parsing options Properties
|
- Source:
Returns:
The raw chunks array (by order of appearance) and an object of these chunks indexed by chunk type (as a 32 bit unsigned int)
- Type
- Promise.<{chunks: Array.<Chunk>, chunksByType: Array.<{type:number, chunks:Array.<Chunk>}>}> | null
(inner) extractNextChunk(buffer, offset, parseCrcopt) → {Object.<{offset: number, crc: number, crcBuf: Buffer, chunk: Chunk}>}
Extract a chunk from a PNG buffer
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
buffer |
Buffer | Raw PNG Buffer |
||
offset |
number | Current read offset |
||
parseCrc |
boolean |
<optional> |
false | If truthy, crc of each chunk is parsed |
- Source:
Returns:
Parsed chunk, chunk's CRC and new offset
- Type
- Object.<{offset: number, crc: number, crcBuf: Buffer, chunk: Chunk}>