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

Function writeBlob

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

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