MCPcopy Index your code
hub / github.com/molnarg/node-http2 / cut

Function cut

lib/protocol/compressor.js:1353–1362  ·  view source on GitHub ↗
(buffer, size)

Source from the content-addressed store, hash-verified

1351
1352// Cut `buffer` into chunks not larger than `size`
1353function cut(buffer, size) {
1354 var chunks = [];
1355 var cursor = 0;
1356 do {
1357 var chunkSize = Math.min(size, buffer.length - cursor);
1358 chunks.push(buffer.slice(cursor, cursor + chunkSize));
1359 cursor += chunkSize;
1360 } while(cursor < buffer.length);
1361 return chunks;
1362}
1363
1364function trim(string) {
1365 return string.trim();

Callers 1

compressor.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected