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

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