MCPcopy Create free account
hub / github.com/ampproject/amphtml / writeChunk

Function writeChunk

build-system/server/app.js:1093–1105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1091 res.writeHead(200, {'Content-Type': 'text/html'});
1092 let pos = 0;
1093 const writeChunk = function () {
1094 const chunk = file.substring(
1095 pos,
1096 Math.min(pos + stream, file.length)
1097 );
1098 res.write(chunk);
1099 pos += stream;
1100 if (pos < file.length) {
1101 setTimeout(writeChunk, 500);
1102 } else {
1103 res.end();
1104 }
1105 };
1106 writeChunk();
1107 } else {
1108 res.send(file);

Callers 1

app.jsFile · 0.85

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected