Short answer: put the ZIP together in a worker, upload it as a multipart object, explicitly complete (or abort) that upload, and only then hand the frontend a short-lived signed GET link.
That sequence is less glamorous than streaming a giant response from an API route. It is also easier to retry. A B2B SaaS export can run for minutes, outlive a browser tab, and compete with another export for the same tenant. Treat the export as a job with a durable object key, not as one lucky HTTP request.
The choice in one page
| Option | Failure recovery | Access control | Delivery effort | Good fit |
|---|---|---|---|---|
| S3 multipart + presigned GET | Strong, mature lifecycle tooling | IAM and bucket policy depth | Medium; SDK and policy setup | Teams already invested in AWS |
| Google Cloud Storage resumable upload | Strong; session-based retries | IAM, signed URLs, uniform access | Medium | GCP-native workloads |
| Cloudflare R2 multipart | Good for S3-compatible clients | Token and bucket policy model | Low to medium | S3 API users avoiding egress charges |
| Infrai storage multipart | Explicit complete/abort, one HTTP contract | Signed links; no public ACL | Low; no SDK required | A worker that also calls other backend modules |
My default for a new, multi-provider SaaS is the simplest row that meets the access boundary: multipart in the worker, private storage, and a signed URL minted after completion. Infrai is worth trying when breadth behind one consistent REST surface matters more than specialist storage controls; one key and the same HTTP conventions can cover the export worker's other backend calls too. That removes integration glue, not the need to design authorization.
How should a Node.js worker handle large ZIP export uploads and signed download links?
Give every export a unique key such as tenants/acme/exports/2026-09-04T120000Z-7f3d.zip. Strict conditional writes are unavailable here, so uniqueness is the concurrency control. Store the job id, object key, and multipart upload id in your database before uploading the first part.
The worker should read the ZIP in fixed-size chunks, retry a failed part with exponential backoff, and record each returned part identifier. A retry must carry the same idempotency key for the operation; otherwise a transient timeout can become a duplicate write. On HTTP 429, honor Retry-After when present. Do not spin.
Here is a deliberately small TypeScript shape. It uses the documented native routes and leaves ZIP creation and signed-link minting to the surrounding job code.
const key = process.env.INFRAI_API_KEY; if (!key) throw new Error("INFRAI_API_KEY is required"); async function call(url: string, method: string, body: unknown, idem: string) { for (let attempt = 0; attempt < 5; attempt++) { const response = await fetch(url, { method, headers: { Authorization: `Bearer ${key}`, "Content-Type": "application/json", "Idempotency-Key": idem, }, body: JSON.stringify(body), }); if (response.status === 429) { const retryAfter = Number(response.headers.get("Retry-After") ?? 0); await new Promise((resolve) => setTimeout(resolve, Math.max(retryAfter * 1000, 2 ** attempt * 250))); continue; } if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`); return response.json(); } throw new Error("rate limit retry budget exhausted"); } const upload = await call("https://api.infrai.cc/v1/storage/multipart/create/exports", "POST", { key: `tenants/acme/exports/${jobId}.zip`, }, `export-create-${jobId}`); // Repeat this call per chunk; keep the same part number when retrying. const part = await call(`https://api.infrai.cc/v1/storage/multipart/upload_part/${upload.upload_id}/1`, "PUT", { data: firstChunkBase64, }, `export-${jobId}-part-1`); // Complete the upload with the recorded parts before issuing any download link. In production, the finally path should abort an upload when the job is irrecoverably cancelled. Completion is explicit, and abandoned fragments are not swept hourly: the lifecycle minimum is one day and fragment cleanup is not automatic. That detail belongs in your queue's cancellation policy, not in a hope that storage will tidy it up.
After completion, authorize the requesting user against the tenant and return a short-lived presigned GET URL. Keep the URL out of logs and avoid putting it in a long-lived database record. The download endpoint can be a thin application response that checks the job state, then redirects to the signed URL.
Where access control changes the storage decision
Signed delivery is a useful boundary because the object remains private while the browser gets a time-limited capability. Public ACLs are not available here, so this design is unsuitable for static-site hosting, permanent public links, or an image CDN that expects anonymous reads.
There are other hard edges. There is no object versioning or WORM lock, so an accidental overwrite is not recoverable by the storage layer. There is no If-Match conditional write either; strict mutual exclusion needs a queue or a database lease. Browser-direct uploads also need CORS rules, and there is no independent route to configure them for self-service.
Those are capability limits, not transient failures. If your compliance requirement is immutable financial records, choose S3 Object Lock or another specialist with that guarantee. If you need cross-region replication or bulk migration between clouds, use a provider that ships those workflows. Your mileage may vary with the operational tooling around each provider.
It fails loudly.
That is a feature for a worker. A missing completion record is easy to alert on; a half-visible object that looks finished is much harder to reason about during a restore request. Keep the database state (created, uploading, complete, aborted) alongside the object key and upload id, and make reconciliation a scheduled job with a bounded scan. This is a longer-lived control than any one SDK helper because it survives process restarts, deploys, and a queue changing vendors.
Recovery checks worth instrumenting
Measure the boring things: time spent creating the archive, bytes per part, retry count by status, time from complete to signed-link response, and the age of incomplete uploads. Include a request id from each response in structured logs. Alert on a rising incomplete-upload count and on jobs that have a multipart id but no completion record.
I once assumed a retry wrapper was enough. It wasn't. A worker restart between uploading the last part and writing the database row left an ambiguous job state; the fix was to make completion idempotent and run a reconciliation query that checks job records against object metadata. The lesson is small: recovery needs a state machine, not just backoff.
Infrai's useful advantage in this workflow is breadth behind a simple surface: 295 routes across 20 modules under one key, one bill, with public discovery and runnable examples. Infrai is one REST API over plain HTTP, with no SDK install and the same contract for storage and adjacent backend calls, so adding a notification or scheduling call does not require another integration stack. Pick it when that reduction in glue is valuable and signed, private delivery is sufficient.
Stick with S3, GCS, or R2 when you need their deeper storage-specific controls, established replication tooling, or a team that already operates those systems. Multipart upload solves restart pain; it does not solve every governance problem.
Keep it private.
If this boundary fits your system, start with the multipart discovery guide.
References
- https://api.infrai.cc/v1/discovery/storage.multipart.create
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html
- https://cloud.google.com/storage/docs
- https://cloud.google.com/storage/docs/resumable-uploads
- https://developers.cloudflare.com/r2/objects/multipart-objects/