@nextlyhq/storage-vercel-blob 0.0.2-alpha.62 → 0.0.2-alpha.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { put, del, head, list } from '@vercel/blob';
1
+ import { put, del, head, BlobNotFoundError, list } from '@vercel/blob';
2
2
 
3
3
  // src/adapter.ts
4
4
 
5
- // ../nextly/dist/chunk-SAEVUREH.mjs
5
+ // ../nextly/dist/chunk-HJ5IQPOY.mjs
6
6
  function isDbError(err) {
7
7
  if (!err || typeof err !== "object") return false;
8
8
  const obj = err;
@@ -41,6 +41,21 @@ var NEXTLY_ERROR_STATUS = {
41
41
  MIME_BLOCKED: 415,
42
42
  MIME_NOT_ALLOWED: 415,
43
43
  SIZE_EXCEEDED: 413,
44
+ // A stored object exceeded the cap a READ was given, which is a different
45
+ // question from SIZE_EXCEEDED above: that one refuses an upload the caller
46
+ // is sending, this one refuses to buffer an object already stored. Kept
47
+ // apart so a caller discriminating on the code cannot match both.
48
+ STORAGE_READ_TOO_LARGE: 413,
49
+ // A stored object did not answer within the deadline the read was given. 504
50
+ // rather than 500 because the failure is the BACKEND not answering, and a
51
+ // caller can act on that difference: a gateway timeout is worth retrying, an
52
+ // internal error is not.
53
+ STORAGE_READ_TIMEOUT: 504,
54
+ // The store answered, and answered badly. 502 rather than 500 because the
55
+ // fault is UPSTREAM of this process: a caller can retry it, and an operator
56
+ // reading the log needs to look at the bucket rather than at this service.
57
+ // Distinct from the timeout above, which never got an answer at all.
58
+ STORAGE_READ_UNREACHABLE: 502,
44
59
  MAGIC_BYTE_MISMATCH: 400,
45
60
  SVG_SANITIZATION_FAILED: 400,
46
61
  UNSUPPORTED_FOR_BACKEND: 415,
@@ -427,6 +442,523 @@ var NextlyError = class _NextlyError extends Error {
427
442
  }
428
443
  };
429
444
 
445
+ // ../nextly/dist/chunk-W77AQUUQ.mjs
446
+ var StorageReadTooLargeError = class extends NextlyError {
447
+ constructor(path, maxBytes, size) {
448
+ super({
449
+ code: "STORAGE_READ_TOO_LARGE",
450
+ publicMessage: "The stored file is larger than the limit for this read.",
451
+ logContext: {
452
+ path,
453
+ maxBytes,
454
+ ...size === void 0 ? {} : { size }
455
+ }
456
+ });
457
+ this.path = path;
458
+ this.maxBytes = maxBytes;
459
+ this.size = size;
460
+ }
461
+ };
462
+
463
+ // ../nextly/dist/chunk-C2VHLQKK.mjs
464
+ var IPV4_RE = /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;
465
+ var PRIVATE_IPV4_CIDRS = [
466
+ "0.0.0.0/8",
467
+ // RFC1122 "this network" / wildcard
468
+ "10.0.0.0/8",
469
+ // RFC1918
470
+ "100.64.0.0/10",
471
+ // RFC6598 CGNAT
472
+ "127.0.0.0/8",
473
+ // RFC1122 loopback
474
+ "169.254.0.0/16",
475
+ // RFC3927 link-local + AWS/GCP metadata
476
+ "172.16.0.0/12",
477
+ // RFC1918
478
+ "192.0.0.0/24",
479
+ // RFC6890 IETF protocol assignments
480
+ "192.0.2.0/24",
481
+ // RFC5737 documentation
482
+ "192.168.0.0/16",
483
+ // RFC1918
484
+ "198.18.0.0/15",
485
+ // RFC2544 benchmarking
486
+ "198.51.100.0/24",
487
+ // RFC5737 documentation
488
+ "203.0.113.0/24",
489
+ // RFC5737 documentation
490
+ "224.0.0.0/4",
491
+ // RFC5771 multicast
492
+ "240.0.0.0/4"
493
+ // RFC1112 reserved
494
+ ];
495
+ var CLOUD_METADATA_HOSTS = /* @__PURE__ */ new Set([
496
+ "metadata.google.internal",
497
+ "metadata.googleapis.com",
498
+ "metadata"
499
+ // GCP short form
500
+ ]);
501
+ var ExternalUrlError = class extends NextlyError {
502
+ constructor(message, url) {
503
+ super({
504
+ code: "EXTERNAL_URL_BLOCKED",
505
+ publicMessage: message,
506
+ logContext: { url }
507
+ });
508
+ this.url = url;
509
+ this.name = "ExternalUrlError";
510
+ }
511
+ };
512
+ async function validateExternalUrl(rawUrl, options = {}) {
513
+ let parsed;
514
+ try {
515
+ parsed = new URL(rawUrl);
516
+ } catch {
517
+ throw new ExternalUrlError("Invalid URL", rawUrl);
518
+ }
519
+ const hostname = parsed.hostname.toLowerCase().replace(/^\[|\]$/g, "");
520
+ const isLocalhostHostname = hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1";
521
+ const baseProtocols = options.allowedProtocols ?? ["https:"];
522
+ const protocols = options.allowLocalhost && isLocalhostHostname ? [...baseProtocols, "http:"] : baseProtocols;
523
+ if (!protocols.includes(parsed.protocol)) {
524
+ throw new ExternalUrlError(
525
+ `Protocol ${parsed.protocol} not allowed (allowed: ${protocols.join(", ")})`,
526
+ rawUrl
527
+ );
528
+ }
529
+ if (CLOUD_METADATA_HOSTS.has(hostname)) {
530
+ throw new ExternalUrlError(
531
+ `Cloud-metadata hostname rejected: ${parsed.hostname}`,
532
+ rawUrl
533
+ );
534
+ }
535
+ if (IPV4_RE.test(hostname)) {
536
+ if (!isPublicIpv4(
537
+ hostname,
538
+ options.allowLocalhost === true && hostname === "127.0.0.1"
539
+ )) {
540
+ throw new ExternalUrlError(
541
+ `Resolved to non-public IP: ${hostname}`,
542
+ rawUrl
543
+ );
544
+ }
545
+ return { url: parsed, pinnedIp: hostname, family: 4 };
546
+ }
547
+ if (hostname.includes(":")) {
548
+ if (!isPublicIpv6(
549
+ hostname,
550
+ options.allowLocalhost === true && hostname === "::1"
551
+ )) {
552
+ throw new ExternalUrlError(
553
+ `Resolved to non-public IP: ${hostname}`,
554
+ rawUrl
555
+ );
556
+ }
557
+ return { url: parsed, pinnedIp: hostname, family: 6 };
558
+ }
559
+ const { lookup } = await import('dns/promises');
560
+ let addresses;
561
+ try {
562
+ addresses = await lookup(hostname, { all: true });
563
+ } catch (err) {
564
+ throw new ExternalUrlError(
565
+ `DNS lookup failed: ${err.message}`,
566
+ rawUrl
567
+ );
568
+ }
569
+ if (addresses.length === 0) {
570
+ throw new ExternalUrlError("No IPs returned for host", rawUrl);
571
+ }
572
+ for (const { address, family } of addresses) {
573
+ const allow = options.allowLocalhost === true && isLocalhostHostname && family === 4;
574
+ const ok = family === 4 ? isPublicIpv4(address, allow) : isPublicIpv6(address, allow);
575
+ if (!ok) {
576
+ throw new ExternalUrlError(
577
+ `Resolved to non-public IP: ${address}`,
578
+ rawUrl
579
+ );
580
+ }
581
+ }
582
+ const first = addresses[0];
583
+ return {
584
+ url: parsed,
585
+ pinnedIp: first.address,
586
+ family: first.family === 6 ? 6 : 4
587
+ };
588
+ }
589
+ var DEFAULT_MAX_RESPONSE_BYTES = 10 * 1024 * 1024;
590
+ var DEFAULT_TIMEOUT_MS = 3e4;
591
+ var SafeFetchError = class extends NextlyError {
592
+ constructor(message, url, reason, status) {
593
+ super({
594
+ code: "EXTERNAL_REQUEST_FAILED",
595
+ publicMessage: message,
596
+ logContext: { url, reason }
597
+ });
598
+ this.url = url;
599
+ this.reason = reason;
600
+ this.status = status;
601
+ this.name = "SafeFetchError";
602
+ }
603
+ };
604
+ function createPinnedLookup(ip, family) {
605
+ return (_hostname, options, callback) => {
606
+ if (options && options.all) {
607
+ callback(null, [{ address: ip, family }]);
608
+ } else {
609
+ callback(null, ip, family);
610
+ }
611
+ };
612
+ }
613
+ async function safeFetch(rawUrl, options = {}) {
614
+ const {
615
+ allowLocalhost,
616
+ allowedProtocols,
617
+ method,
618
+ headers,
619
+ body,
620
+ signal,
621
+ maxResponseBytes = DEFAULT_MAX_RESPONSE_BYTES,
622
+ timeoutMs = DEFAULT_TIMEOUT_MS
623
+ } = options;
624
+ const controller = new AbortController();
625
+ const forwardAbort = () => controller.abort(signal?.reason);
626
+ if (signal) {
627
+ if (signal.aborted) controller.abort(signal.reason);
628
+ else signal.addEventListener("abort", forwardAbort, { once: true });
629
+ }
630
+ const timer = setTimeout(
631
+ () => controller.abort(
632
+ new SafeFetchError(`Request exceeded ${timeoutMs}ms`, rawUrl, "timeout")
633
+ ),
634
+ timeoutMs
635
+ );
636
+ try {
637
+ const validated = await abortable(
638
+ validateExternalUrl(rawUrl, { allowLocalhost, allowedProtocols }),
639
+ controller.signal
640
+ );
641
+ return await pinnedFetch(validated, {
642
+ method,
643
+ headers,
644
+ body,
645
+ signal: controller.signal,
646
+ maxResponseBytes
647
+ });
648
+ } finally {
649
+ clearTimeout(timer);
650
+ if (signal) signal.removeEventListener("abort", forwardAbort);
651
+ }
652
+ }
653
+ function abortError(signal) {
654
+ const reason = signal.reason;
655
+ if (reason instanceof Error) return reason;
656
+ return new DOMException("The operation was aborted", "AbortError");
657
+ }
658
+ function abortable(promise, signal) {
659
+ if (signal.aborted) return Promise.reject(abortError(signal));
660
+ let onAbort;
661
+ const aborted = new Promise((_resolve, reject) => {
662
+ onAbort = () => reject(abortError(signal));
663
+ signal.addEventListener("abort", onAbort, { once: true });
664
+ });
665
+ return Promise.race([promise, aborted]).finally(
666
+ () => signal.removeEventListener("abort", onAbort)
667
+ );
668
+ }
669
+ async function pinnedFetch(validated, init) {
670
+ const { url, pinnedIp, family } = validated;
671
+ const httpMod = url.protocol === "https:" ? await import('https') : await import('http');
672
+ const zlib = await import('zlib');
673
+ const lookup = createPinnedLookup(pinnedIp, family);
674
+ const outHeaders = toOutgoingHeaders(init.headers);
675
+ if (init.body != null) {
676
+ delete outHeaders["transfer-encoding"];
677
+ outHeaders["content-length"] = String(
678
+ typeof init.body === "string" ? Buffer.byteLength(init.body) : init.body.byteLength
679
+ );
680
+ }
681
+ return new Promise((resolve, reject) => {
682
+ let settled = false;
683
+ const settle = (fn) => {
684
+ if (settled) return;
685
+ settled = true;
686
+ fn();
687
+ };
688
+ const failure = (err) => init.signal.aborted ? abortError(init.signal) : err;
689
+ const req = httpMod.request(
690
+ url,
691
+ {
692
+ method: init.method ?? "GET",
693
+ headers: outHeaders,
694
+ lookup,
695
+ // Fresh socket per request so a pooled connection can't reuse a
696
+ // differently-resolved address, and so the pinned lookup always runs.
697
+ agent: false,
698
+ // The combined deadline/caller signal aborts the request in flight.
699
+ signal: init.signal
700
+ },
701
+ (res) => {
702
+ const chunks = [];
703
+ let received = 0;
704
+ res.on("data", (chunk) => {
705
+ received += chunk.length;
706
+ if (received > init.maxResponseBytes) {
707
+ res.destroy();
708
+ req.destroy();
709
+ settle(
710
+ () => reject(
711
+ new SafeFetchError(
712
+ `Response body exceeded ${init.maxResponseBytes} bytes`,
713
+ url.href,
714
+ "response-too-large",
715
+ res.statusCode
716
+ )
717
+ )
718
+ );
719
+ return;
720
+ }
721
+ chunks.push(chunk);
722
+ });
723
+ res.on("end", () => {
724
+ const decoded = decodeBody(
725
+ Buffer.concat(chunks),
726
+ res.headers["content-encoding"],
727
+ zlib,
728
+ init.maxResponseBytes,
729
+ url.href,
730
+ res.statusCode
731
+ );
732
+ if (decoded instanceof SafeFetchError) {
733
+ settle(() => reject(decoded));
734
+ return;
735
+ }
736
+ settle(
737
+ () => resolve(toWhatwgResponse(res, decoded.body, decoded.decoded))
738
+ );
739
+ });
740
+ res.on("error", (err) => settle(() => reject(failure(err))));
741
+ }
742
+ );
743
+ req.on("error", (err) => settle(() => reject(failure(err))));
744
+ if (!req.destroyed) {
745
+ if (init.body != null) req.write(init.body);
746
+ req.end();
747
+ }
748
+ });
749
+ }
750
+ function toOutgoingHeaders(headers) {
751
+ const out = {};
752
+ if (!headers) return out;
753
+ const add = (rawKey, value) => {
754
+ const key = rawKey.toLowerCase();
755
+ if (key === "host") return;
756
+ const existing = out[key];
757
+ out[key] = existing === void 0 ? value : [].concat(existing, value);
758
+ };
759
+ if (headers instanceof Headers) {
760
+ headers.forEach((value, key) => add(key, value));
761
+ } else if (Array.isArray(headers)) {
762
+ for (const [key, value] of headers) add(key, value);
763
+ } else {
764
+ for (const [key, value] of Object.entries(headers)) add(key, value);
765
+ }
766
+ return out;
767
+ }
768
+ function toWhatwgResponse(res, body, stripContentHeaders) {
769
+ const headers = new Headers();
770
+ for (const [key, value] of Object.entries(res.headers)) {
771
+ if (value == null) continue;
772
+ const lower = key.toLowerCase();
773
+ if (stripContentHeaders && (lower === "content-encoding" || lower === "content-length")) {
774
+ continue;
775
+ }
776
+ const values = Array.isArray(value) ? value : [value];
777
+ for (const v of values) {
778
+ try {
779
+ headers.append(key, v);
780
+ } catch {
781
+ }
782
+ }
783
+ }
784
+ const raw = res.statusCode ?? 502;
785
+ const status = raw >= 200 && raw <= 599 ? raw : 502;
786
+ const nullBody = status === 204 || status === 205 || status === 304;
787
+ const bytes = new Uint8Array(body.byteLength);
788
+ bytes.set(body);
789
+ return new Response(nullBody ? null : bytes, {
790
+ status,
791
+ statusText: res.statusMessage ?? "",
792
+ headers
793
+ });
794
+ }
795
+ function decodeBody(buf, encoding, zlib, cap, url, status) {
796
+ if (!encoding) return { body: buf, decoded: false };
797
+ if (buf.length === 0) return { body: buf, decoded: true };
798
+ const layers = encoding.split(",").map((e) => e.trim().toLowerCase()).filter(Boolean);
799
+ const opts = { maxOutputLength: cap };
800
+ let current = buf;
801
+ let decoded = false;
802
+ try {
803
+ for (let i = layers.length - 1; i >= 0; i--) {
804
+ const enc = layers[i];
805
+ if (enc === "identity") continue;
806
+ if (enc === "gzip" || enc === "x-gzip") {
807
+ current = zlib.gunzipSync(current, opts);
808
+ } else if (enc === "br") {
809
+ current = zlib.brotliDecompressSync(current, opts);
810
+ } else if (enc === "deflate") {
811
+ try {
812
+ current = zlib.inflateSync(current, opts);
813
+ } catch (inflateErr) {
814
+ if (errorCode(inflateErr) === "ERR_BUFFER_TOO_LARGE")
815
+ throw inflateErr;
816
+ current = zlib.inflateRawSync(current, opts);
817
+ }
818
+ } else {
819
+ if (decoded) {
820
+ return new SafeFetchError(
821
+ `Cannot fully decode content-encoding "${encoding}"`,
822
+ url,
823
+ "decode-failed",
824
+ status
825
+ );
826
+ }
827
+ return { body: buf, decoded: false };
828
+ }
829
+ decoded = true;
830
+ }
831
+ return { body: current, decoded };
832
+ } catch (err) {
833
+ const tooLarge = errorCode(err) === "ERR_BUFFER_TOO_LARGE";
834
+ return new SafeFetchError(
835
+ tooLarge ? `Decoded ${encoding} response body exceeded the size cap` : `Failed to decode ${encoding} response body`,
836
+ url,
837
+ tooLarge ? "response-too-large" : "decode-failed",
838
+ status
839
+ );
840
+ }
841
+ }
842
+ function errorCode(err) {
843
+ if (err != null && typeof err === "object" && "code" in err) {
844
+ const code = err.code;
845
+ return typeof code === "string" ? code : void 0;
846
+ }
847
+ return void 0;
848
+ }
849
+ function ipv4ToInt(ip) {
850
+ const parts = ip.split(".");
851
+ if (parts.length !== 4) return null;
852
+ let acc = 0;
853
+ for (const p of parts) {
854
+ const n = Number(p);
855
+ if (!Number.isInteger(n) || n < 0 || n > 255) return null;
856
+ acc = acc << 8 | n;
857
+ }
858
+ return acc >>> 0;
859
+ }
860
+ function isIpv4InCidr(intIp, cidr) {
861
+ const [addr, prefixRaw] = cidr.split("/");
862
+ const intCidr = ipv4ToInt(addr);
863
+ if (intCidr === null) return false;
864
+ const prefix = Number(prefixRaw);
865
+ if (!Number.isInteger(prefix) || prefix < 0 || prefix > 32) return false;
866
+ const mask = prefix === 0 ? 0 : -1 >>> 32 - prefix << 32 - prefix;
867
+ return (intIp & mask) >>> 0 === (intCidr & mask) >>> 0;
868
+ }
869
+ function isPublicIpv4(addr, allowLoopback) {
870
+ const intIp = ipv4ToInt(addr);
871
+ if (intIp === null) return false;
872
+ if (allowLoopback && addr === "127.0.0.1") return true;
873
+ for (const cidr of PRIVATE_IPV4_CIDRS) {
874
+ if (isIpv4InCidr(intIp, cidr)) return false;
875
+ }
876
+ return true;
877
+ }
878
+ function mappedIpv4(lower) {
879
+ const dotted = lower.match(/^::ffff:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);
880
+ if (dotted) return dotted[1];
881
+ const hex = lower.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/);
882
+ if (hex) {
883
+ const hi = parseInt(hex[1], 16);
884
+ const lo = parseInt(hex[2], 16);
885
+ return [hi >> 8, hi & 255, lo >> 8, lo & 255].join(".");
886
+ }
887
+ return null;
888
+ }
889
+ function isPublicIpv6(addr, allowLoopback) {
890
+ const lower = addr.toLowerCase();
891
+ if (allowLoopback && lower === "::1") return true;
892
+ const mapped = mappedIpv4(lower);
893
+ if (mapped) {
894
+ return isPublicIpv4(mapped, allowLoopback);
895
+ }
896
+ if (lower === "::" || lower === "::1") return false;
897
+ const firstHextet = lower.split(":")[0] || "";
898
+ if (firstHextet.startsWith("fc") || firstHextet.startsWith("fd"))
899
+ return false;
900
+ if (firstHextet.startsWith("fe8") || firstHextet.startsWith("fe9"))
901
+ return false;
902
+ if (firstHextet.startsWith("fea") || firstHextet.startsWith("feb"))
903
+ return false;
904
+ if (firstHextet.startsWith("ff")) return false;
905
+ return true;
906
+ }
907
+ async function fetchStoredBytes(url, context, label, options, signal) {
908
+ let response;
909
+ try {
910
+ response = await safeFetch(url, {
911
+ ...options?.maxBytes === void 0 ? {} : { maxResponseBytes: options.maxBytes },
912
+ /*
913
+ * A caller's signal REPLACES the deadline rather than joining it.
914
+ *
915
+ * These adapters look the object's address up before fetching it, and
916
+ * that lookup can stall too. Starting a fresh timer here would give the
917
+ * fetch its own full budget on top of however long the lookup took, so a
918
+ * read could outlive the deadline the caller was told applied — by
919
+ * roughly double. One signal begun before the lookup governs both phases.
920
+ */
921
+ ...signal !== void 0 ? { signal } : options?.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs }
922
+ });
923
+ } catch (error) {
924
+ const verdict = classifyFetchFailure(error);
925
+ if (verdict === "absent") return null;
926
+ if (verdict === "oversized") {
927
+ throw new StorageReadTooLargeError(
928
+ context,
929
+ resolveReadBounds(options).maxBytes
930
+ );
931
+ }
932
+ throw error;
933
+ }
934
+ if (response.status === 404) return null;
935
+ if (!response.ok) {
936
+ throw NextlyError.internal({
937
+ logContext: {
938
+ service: label,
939
+ path: context,
940
+ status: response.status,
941
+ statusText: response.statusText
942
+ }
943
+ });
944
+ }
945
+ return Buffer.from(await response.arrayBuffer());
946
+ }
947
+ function classifyFetchFailure(error) {
948
+ if (!(error instanceof SafeFetchError)) return "unknown";
949
+ if (error.status === 404) return "absent";
950
+ const successful = error.status !== void 0 && error.status >= 200 && error.status < 300;
951
+ return error.reason === "response-too-large" && successful ? "oversized" : "unknown";
952
+ }
953
+ var DEFAULT_READ_TIMEOUT_MS = DEFAULT_TIMEOUT_MS;
954
+ var DEFAULT_READ_MAX_BYTES = DEFAULT_MAX_RESPONSE_BYTES;
955
+ function resolveReadBounds(options) {
956
+ return {
957
+ maxBytes: options?.maxBytes ?? DEFAULT_READ_MAX_BYTES,
958
+ timeoutMs: options?.timeoutMs ?? DEFAULT_READ_TIMEOUT_MS
959
+ };
960
+ }
961
+
430
962
  // src/adapter.ts
431
963
  var VercelBlobStorageAdapter = class {
432
964
  /**
@@ -565,6 +1097,48 @@ var VercelBlobStorageAdapter = class {
565
1097
  return false;
566
1098
  }
567
1099
  }
1100
+ /**
1101
+ * Read a stored blob back as bytes, or `null` when it is not there.
1102
+ *
1103
+ * A NETWORK round trip, unlike the local adapter's disk read, because the
1104
+ * bytes live on Vercel's CDN and there is no other way to reach them. That
1105
+ * cost is the reason a caller serving these from its own origin has to cache:
1106
+ * the privacy rule that forces same-origin serving does not also make the
1107
+ * fetch free, and an uncached proxy pays it on every request.
1108
+ *
1109
+ * The URL is taken from `head` rather than assembled from `filePath`,
1110
+ * because a blob's address is issued by the service — it carries a random
1111
+ * suffix this adapter never chose — so deriving one here would be guessing at
1112
+ * a string another system owns.
1113
+ *
1114
+ * `null` for a missing blob rather than a throw, matching {@link exists}.
1115
+ *
1116
+ * @param filePath - Blob path/key
1117
+ * @returns The blob's bytes, or `null` when it does not exist
1118
+ */
1119
+ async read(filePath, options) {
1120
+ const deadline = AbortSignal.timeout(
1121
+ options?.timeoutMs ?? DEFAULT_READ_TIMEOUT_MS
1122
+ );
1123
+ let target;
1124
+ try {
1125
+ const meta = await head(filePath, {
1126
+ token: this.resolvedConfig.token,
1127
+ abortSignal: deadline
1128
+ });
1129
+ target = meta.downloadUrl ?? meta.url;
1130
+ } catch (error) {
1131
+ if (error instanceof BlobNotFoundError) return null;
1132
+ throw error;
1133
+ }
1134
+ return await fetchStoredBytes(
1135
+ target,
1136
+ filePath,
1137
+ "Vercel Blob",
1138
+ options,
1139
+ deadline
1140
+ );
1141
+ }
568
1142
  /**
569
1143
  * Get public URL for Vercel Blob file.
570
1144
  *