MCPcopy Create free account
hub / github.com/angular/dev-infra / writeBlob

Function writeBlob

github-actions/browserstack/set-browserstack-env.js:6858–6882  ·  view source on GitHub ↗
(abort, body, client, request, socket, contentLength, header, expectsPayload)

Source from the content-addressed store, hash-verified

6856 }
6857 }
6858 function writeBlob(abort, body, client, request, socket, contentLength, header, expectsPayload) {
6859 return __async(this, null, function* () {
6860 assert(contentLength === body.size, "blob body must have content length");
6861 try {
6862 if (contentLength != null && contentLength !== body.size) {
6863 throw new RequestContentLengthMismatchError();
6864 }
6865 const buffer = Buffer.from(yield body.arrayBuffer());
6866 socket.cork();
6867 socket.write(`${header}content-length: ${contentLength}\r
6868\r
6869`, "latin1");
6870 socket.write(buffer);
6871 socket.uncork();
6872 request.onBodySent(buffer);
6873 request.onRequestSent();
6874 if (!expectsPayload && request.reset !== false) {
6875 socket[kReset] = true;
6876 }
6877 client[kResume]();
6878 } catch (err) {
6879 abort(err);
6880 }
6881 });
6882 }
6883 function writeIterable(abort, body, client, request, socket, contentLength, header, expectsPayload) {
6884 return __async(this, null, function* () {
6885 assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined");

Callers 2

writeH1Function · 0.70
writeBodyH2Function · 0.70

Calls 7

__asyncFunction · 0.70
abortFunction · 0.70
arrayBufferMethod · 0.45
writeMethod · 0.45
onBodySentMethod · 0.45
onRequestSentMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected