(type, data)
| 90 | } |
| 91 | |
| 92 | function chunk(type, data) { |
| 93 | const typeBuf = Buffer.from(type, 'ascii') |
| 94 | const len = Buffer.alloc(4) |
| 95 | len.writeUInt32BE(data.length, 0) |
| 96 | const crc = Buffer.alloc(4) |
| 97 | crc.writeUInt32BE(crc32(Buffer.concat([typeBuf, data])), 0) |
| 98 | return Buffer.concat([len, typeBuf, data, crc]) |
| 99 | } |
| 100 | |
| 101 | const ihdr = Buffer.alloc(13) |
| 102 | ihdr.writeUInt32BE(width, 0) |
no test coverage detected