UNPKG

image-size

Version:
19 lines (15 loc) 537 B
'use strict'; // lib/types/utils.ts new TextDecoder(); var getView = (input, offset) => new DataView(input.buffer, input.byteOffset + offset); var readUInt32BE = (input, offset = 0) => getView(input, offset).getUint32(0, false); // lib/types/j2c.ts var J2C = { // TODO: this doesn't seem right. SIZ marker doesn't have to be right after the SOC validate: (input) => readUInt32BE(input, 0) === 4283432785, calculate: (input) => ({ height: readUInt32BE(input, 12), width: readUInt32BE(input, 8) }) }; exports.J2C = J2C;