INNER CODE UNIT · TypeScript

end

cloudflare/serverless-registry · push/index.ts:268

  let end = Math.min(maxChunkLength, totalLayerSize);
  let written = 0;
  let previousReadable: ReadableLimiter | undefined;
  let totalLayerSizeLeft = totalLayerSize;
  while (totalLayerSizeLeft > 0) {
    const range = `0-${Math.min(end, totalLayerSize) - 1}`;
    const current = new ReadableLimiter(reader as ReadableStreamDefaultReader, maxToWrite, previousReadable);
    const patchChunkUploadURL = parseLocation(location);
    // we have to do fetchNode because Bun doesn't allow setting custom Content-Length.
    // https://github.com/oven-sh/bun/issues/10507
    const patchChunkResult = await fetchNode(patchChunkUploadURL, {
      method: "PATCH",
      body: current,
      headers: new Headers({
        "range": range,
        "authorization": cred,
        "content-length": `${Math.min(totalLayerSizeLeft, maxToWrite)}`,
      }),

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…