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

Method write

github-actions/browserstack/set-browserstack-env.js:6945–6994  ·  view source on GitHub ↗
(chunk)

Source from the content-addressed store, hash-verified

6943 client[kResume]();
6944 } catch (err) {
6945 abort(err);
6946 }
6947 }
6948 function writeBlob(abort, body, client, request, socket, contentLength, header, expectsPayload) {
6949 return __async(this, null, function* () {
6950 assert(contentLength === body.size, "blob body must have content length");
6951 try {
6952 if (contentLength != null && contentLength !== body.size) {
6953 throw new RequestContentLengthMismatchError();
6954 }
6955 const buffer = Buffer.from(yield body.arrayBuffer());
6956 socket.cork();
6957 socket.write(`${header}content-length: ${contentLength}\r
6958\r
6959`, "latin1");
6960 socket.write(buffer);
6961 socket.uncork();
6962 request.onBodySent(buffer);
6963 request.onRequestSent();
6964 if (!expectsPayload && request.reset !== false) {
6965 socket[kReset] = true;
6966 }
6967 client[kResume]();
6968 } catch (err) {
6969 abort(err);
6970 }
6971 });
6972 }
6973 function writeIterable(abort, body, client, request, socket, contentLength, header, expectsPayload) {
6974 return __async(this, null, function* () {
6975 assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined");
6976 let callback = null;
6977 function onDrain() {
6978 if (callback) {
6979 const cb = callback;
6980 callback = null;
6981 cb();
6982 }
6983 }
6984 const waitForDrain = () => new Promise((resolve2, reject) => {
6985 assert(callback === null);
6986 if (socket[kError]) {
6987 reject(socket[kError]);
6988 } else {
6989 callback = resolve2;
6990 }
6991 });
6992 socket.on("close", onDrain).on("drain", onDrain);
6993 const writer = new AsyncWriter({ abort, socket, request, contentLength, client, expectsPayload, header });
6994 try {
6995 try {
6996 for (var iter = __forAwait(body), more, temp, error; more = !(temp = yield iter.next()).done; more = false) {
6997 const chunk = temp.value;

Callers 15

_transformMethod · 0.45
onDataFunction · 0.45
writeBufferFunction · 0.45
writeBlobFunction · 0.45
writeIterableFunction · 0.45
endMethod · 0.45
_resumeFunction · 0.45
onDataMethod · 0.45
packageDataFunction · 0.45
closeWebSocketConnectionFunction · 0.45
onSocketDataFunction · 0.45
decompressMethod · 0.45

Calls 6

__awaiterFunction · 0.70
toStringMethod · 0.45
onBodySentMethod · 0.45
refreshMethod · 0.45
filePathMethod · 0.45
emptyBufferMethod · 0.45

Tested by

no test coverage detected