MCPcopy Create free account
hub / github.com/TanStack/ai / chunk

Function chunk

examples/ts-react-chat/scripts/make-repro-image.mjs:92–99  ·  view source on GitHub ↗
(type, data)

Source from the content-addressed store, hash-verified

90}
91
92function 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
101const ihdr = Buffer.alloc(13)
102ihdr.writeUInt32BE(width, 0)

Callers 1

Calls 2

crc32Function · 0.85
fromMethod · 0.80

Tested by

no test coverage detected