Basic PNG chunks extractor
npm install png-chunks-extractorshell
npm i png-chunks-extractor
`
Example
The package supports both ESM import and CJS require.
`javascript
import chunksExtractor from 'png-chunks-extractor';
const {chunks, chunksByType} = await chunksExtractor('path/to/file');
`
chunks is an array of PNG chunks data and type.
`
{
dataBuf: ,
type: 1229472850 // 'IHDR' decimal value
}
`
Documentation
$3
- PNGFile \ | \ The file to parse.
- options \
- validateStruct \ Enables PNG structure validation. Default: true
- validateCrc \ Enables Chunks CRC validation. CRC validation impacts parsing time. Default: false
- throwOnError \ Throws an error whenever there is a validation error. Default: false
- logOnError \ Logs any validation error. Default: true
- Returns \ | \ If the general structure validation fails
- chunks [\type \ The latin1 decimal expression of the type
- dataBuf \ Raw chunk data
- chunksByType \ An object with PNG type keys and chunk objects values
Parses PNGFile` and returns its chunks