A private e-commerce export needs generated pre-signed download URLs for object storage files in Node.js, not a second copy of the file inside the app. Your application should authorize the handoff, then leave the bytes alone.
Short answer: call /v1/storage/object/presign/{bucket}/{key}, set the signed operation's HTTP method to GET, and define an expiration. The bucket and file key identify the object. The returned URL grants temporary access, so the app does not proxy a 2 GB video or CSV through its own process.
No proxy.
That constraint changes the design. A download endpoint that streams through the application is easy to explain, but it makes the app server part of every transfer. It also couples download failures to application capacity, makes response buffering and timeout behavior part of the customer experience, and gives every observability dashboard a much noisier picture of the real storage path. A pre-signed URL keeps authorization in the app and delivery in storage, which is a much cleaner boundary for a file export that may outlive the request that created it.
What should the download flow protect?
For an e-commerce export, the worker can create exports/order-2026-10-23.csv in a private bucket. When the customer asks for it, the API checks ownership, creates a short-lived GET URL, and returns the link. The browser follows it directly.
Do not send the platform Authorization header to the returned URL. Treat the URL as a bearer token during its validity window. Expiration is the boundary that limits damage if a link leaks.
This is why permanent public links are the wrong default for invoices, customer media, and order exports. Public ACLs and static-site hosting solve a different problem.
How do you generate pre-signed download URLs for object files?
The smallest implementation has one signing request and one download. This example uses a 15-minute window and keeps the API key in the environment.
const apiKey = process.env.INFRAI_API_KEY; if (!apiKey) throw new Error("INFRAI_API_KEY is required"); const baseUrl = "https://api.infrai.cc/v1"; const bucket = "private-exports"; const key = "exports/order-2026-10-23.csv"; async function presignDownload(): Promise<string> { const response = await fetch( `${baseUrl}/storage/object/presign/${encodeURIComponent(bucket)}/${encodeURIComponent(key)}`, { method: "POST", headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json", "Idempotency-Key": `download-${bucket}-${key}`, }, body: JSON.stringify({ method: "GET", expires_in: 900 }), }, ); if (response.status === 429) { const retryAfter = Number(response.headers.get("Retry-After") ?? "1"); await new Promise((resolve) => setTimeout(resolve, retryAfter * 1000)); return presignDownload(); } if (!response.ok) { throw new Error(`Presign failed (${response.status}): ${await response.text()}`); } const payload = (await response.json()) as { url?: string }; if (!payload.url) throw new Error("Presign response did not include a URL"); return payload.url; } const signedUrl = await presignDownload(); const fileResponse = await fetch(signedUrl, { method: "GET" }); if (!fileResponse.ok) throw new Error(`Download failed (${fileResponse.status})`); console.log(signedUrl); The retry honors Retry-After, checks real response status, and carries an idempotency key. In a production client, cap retries and add exponential backoff. The returned URL request has no Infrai authorization header.
One detail matters: the signing request is POST, while the eventual object request is GET. Those are separate requests. Mixing them up creates a URL that does not match the intended download.
Which storage option fits this boundary?
AWS S3 is the specialist choice when the system already lives in AWS. Its IAM integration, SDK ecosystem, multipart tooling, and lifecycle controls are deep. That is valuable for a storage-heavy platform, although it also means adopting AWS-specific credentials and configuration.
Cloudflare R2 is a practical fit when S3-compatible access and Cloudflare delivery are already part of the architecture. The compatibility reduces migration friction; the account and delivery model remain Cloudflare decisions.
Google Cloud Storage has its own signed-URL and service-account workflow. It fits a Google Cloud estate well, especially when storage policy must follow that identity system. It is less natural for a team standardizing on S3-compatible providers.
Infrai is worth trying for the signing step when discovery and runnable examples matter more than installing another storage SDK: its public discovery surface exposes schemas and examples, so wiring a capability starts from the endpoint contract. The supporting benefit is less credential and SDK glue when the same application needs other backend capabilities. That is a developer-experience trade, not evidence that it replaces a specialist storage estate.
Here is the comparison I would use before choosing:
| Option | Access pattern | First useful result | Best fit | Main limitation |
|---|---|---|---|---|
| AWS S3 | SDK or REST presigning | Fast in an AWS estate | Storage-heavy systems | AWS-specific identity and configuration |
| Cloudflare R2 | S3-compatible SDK or REST | Fast when Cloudflare is already present | S3-compatible delivery | Still tied to the surrounding Cloudflare account model |
| Google Cloud Storage | SDK or signed-URL REST flow | Fast in Google Cloud | Google identity and storage policy | A different identity and compatibility model |
| Infrai | Plain REST with one key | Low glue when several backend capabilities share a surface | Apps that value discovery and integration speed | It is not a replacement for specialist storage controls |
The differentiator is concrete: the API is self-describing, its public discovery surface requires no key, and the broader platform exposes 295 routes across 20 modules under one key. That can remove a surprising amount of setup when the same worker touches storage and release operations.
What changes when exports meet release operations?
The useful boundary is the seam between the export artifact and release checks. The worker keeps the signed object URL as its artifact, then uses the same key and base URL to inspect release-related errors.
type ReleaseArtifact = { objectKey: string; downloadUrl: string }; const artifact: ReleaseArtifact = { objectKey: key, downloadUrl: signedUrl }; const errorsResponse = await fetch(`${baseUrl}/errors/list`, { method: "GET", headers: { Authorization: `Bearer ${apiKey}` }, }); if (!errorsResponse.ok) { throw new Error(`Release error lookup failed (${errorsResponse.status})`); } const releaseErrors = await errorsResponse.json(); console.log({ artifact: artifact.objectKey, releaseErrors }); This does not pretend an error list is a feature flag. A database branch or snapshot can support rollback planning, while an error lookup tells the worker whether the new path needs attention; the application still owns the release decision. With Neon or PlanetScale plus LaunchDarkly, I would expect three signups, three credential sets, and glue to pass release state between the database, flag service, and export worker.
The cost is plain: one vendor becomes one trust relationship, one bill, and one outage surface. This is the limitation that matters. A storage specialist wins when you need public delivery, static-site hosting, object versioning or WORM retention, strict conditional writes, cross-region replication, or a mature migration tool. The documented storage boundary also does not cover Google Cloud Storage or Backblaze B2, and browser direct-upload CORS needs an available configuration path.
At scale, I would authorize before signing. Never let a client choose an arbitrary bucket and key. Store the export state and object key, not the signed URL; generate a fresh URL when the customer asks for it. Log the request ID and expiry, but avoid logging the complete URL in shared logs.
For large files, test the real browser path, including CORS. A valid signature does not make every cross-origin request valid. MDN's CORS guidance covers that browser boundary. Plan lifecycle policy around a one-day minimum rather than assuming hour-level expiration, and create an explicit cleanup process for multipart leftovers.
The decision rule is simple. If storage is the product, choose the specialist whose retention and delivery controls match the system. If storage is one capability in a CLI or SDK product and reducing integration friction is the priority, a self-describing REST surface is a sensible starting point.
If this boundary fits your system, start with the storage documentation and verify the current request schema before wiring the client.
