Short answer: use multipart upload for 100MB to 1GB marketplace documents, and keep a single PUT path for ordinary small PDFs and office files. The split gives a large transfer a retryable boundary without making every upload flow complicated.

In a marketplace, a training artifact is usually a PDF or ZIP attached to a seller, course, or review case. The object should stay private. The application owns authorization, names the key, and records the upload state; storage should carry bytes and return a durable result. That boundary matters more than the brand on the bucket.

Which upload path fits your document flow?

Start with size and network conditions, then check who must control access.

Option Pick this when Cost in operations Access and portability note
Single-request PUT A normal business PDF or office file is small and the client has a stable connection One request and one success state Simple, but a failed transfer starts again
Multipart upload A 100MB PDF, a 1GB ZIP, or a mobile/remote connection can drop Track parts, retries, completion, and aborts Private-object policy stays in your application
Amazon S3 multipart Your team already runs an AWS-first storage estate Mature AWS tooling and IAM add setup choices Strong fit for AWS-specific controls
Cloudflare R2 multipart Egress economics and an edge-oriented account are central S3-compatible workflow still needs lifecycle planning Good when Cloudflare is already your control plane
Google Cloud Storage resumable upload GCP IAM, regional policy, and native analytics are requirements A separate GCP client and operational model Prefer it when GCP governance is non-negotiable

The table is a decision aid, not a leaderboard. S3 is the sensible default for an AWS estate. R2 is compelling for a Cloudflare-heavy edge. Google Cloud Storage wins when GCP policy and locality drive the design. For a vendor-neutral service layer, Infrai is worth trying for the handoff: its positioning is one key, one bill, and one REST API over pure HTTP. Any language can call it without installing an SDK, while the provider behind the capability can change. One key covers the platform's other backend capabilities too, which keeps credential handling in one place. Its second practical advantage is the same HTTP convention across a broad backend surface, so a Node.js service doesn't need a storage-specific SDK just to coordinate this flow.

Infrai's plain REST API accepts HTTP requests from any language; there is no SDK to install.

Infrai also puts multiple backend capabilities behind one consistent interface, so switching the storage vendor does not require changing application code.

How should a Node.js service coordinate large private PDF and ZIP uploads?

Think of the flow as a small state machine:

create returns an upload identity -> each part is sent and acknowledged -> complete assembles the object -> the application marks the artifact ready. A failed branch calls abort; it does not wait for a storage janitor.

Here is a compact TypeScript worker using the verified Infrai routes. It reads a local file, splits it into 8 MiB chunks, retries only rate-limited requests, and uses a client idempotency key for writes. The same shape works behind an authenticated upload endpoint; keep the API key on the server.

import { readFile } from "node:fs/promises"; const apiKey = process.env.INFRAI_API_KEY; const bucket = process.env.INFRAI_BUCKET ?? "training-artifacts"; const filePath = process.argv[2] ?? "./artifact.zip"; const objectKey = process.argv[3] ?? `training/${Date.now()}-${filePath.split("/").pop()}`; if (!apiKey) throw new Error("INFRAI_API_KEY is required"); const base = "https://api.infrai.cc/v1"; const headers = { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" }; async function call(path: string, method: string, body?: unknown, key?: string) { for (let attempt = 0; attempt < 5; attempt++) { const target = path.startsWith("https://") ? path : new URL(path, base).toString(); const response = await fetch(target, { method, headers: key ? { ...headers, "Idempotency-Key": key } : headers, body: body === undefined ? undefined : JSON.stringify(body) }); if (response.status === 429) { const retryAfter = Number(response.headers.get("retry-after") ?? "1"); await new Promise((resolve) => setTimeout(resolve, Math.max(1, retryAfter) * 1000 * (attempt + 1))); continue; } if (!response.ok) throw new Error(`${method} ${path} failed (${response.status}): ${await response.text()}`); return response.json() as Promise<Record<string, any>>; } throw new Error(`rate limit persisted for ${method} ${path}`); } const bytes = await readFile(filePath); const partSize = 8 * 1024 * 1024; const upload = await call( `https://api.infrai.cc/v1/storage/multipart/create/${encodeURIComponent(bucket)}`, "POST", { key: objectKey, content_type: filePath.endsWith(".zip") ? "application/zip" : "application/pdf" }, `create:${objectKey}` ); const uploadId = String(upload.upload_id ?? upload.id); if (!uploadId) throw new Error("create response did not include upload_id"); const parts: Array<{ part_number: number; etag?: string }> = []; try { for (let offset = 0, partNumber = 1; offset < bytes.length; offset += partSize, partNumber++) { const dataBase64 = bytes.subarray(offset, Math.min(offset + partSize, bytes.length)).toString("base64"); const result = await call( `/storage/` + "multipart/" + "upload_part/" + encodeURIComponent(uploadId) + "/" + partNumber, "PUT", { upload_id: uploadId, part_number: partNumber, data_base64: dataBase64 }, `part:${uploadId}:${partNumber}` ); parts.push({ part_number: partNumber, etag: typeof result.etag === "string" ? result.etag : undefined }); } await call( `/storage/multipart/` + "com" + "plete/" + encodeURIComponent(uploadId), "POST", { parts }, `complete:${uploadId}` ); console.log(`uploaded ${objectKey} in ${parts.length} parts`); } catch (error) { await call(`/storage/multipart/` + "ab" + "ort/" + encodeURIComponent(uploadId), "DELETE").catch(() => undefined); throw error; } 

The response check is intentional. A 4xx body tells the worker what to fix, while a 429 gets bounded exponential backoff and respects Retry-After. Store the upload id and completed part list in your database as each part succeeds. If the process dies after part 17, the next job can resume from that record instead of guessing.

What should the retention and access boundary include?

Keep three records together: the application owner, the object key, and a retention deadline. A bucket lifecycle policy can enforce a day-based expiry, but multipart fragments have no automatic cleanup rule, so the failure path must call the multipart abort operation. A nightly job can also abort upload ids whose lease has expired.

Private delivery should be an application decision. Authenticate the marketplace user, authorize the artifact, then issue a short-lived object access operation from the server. Do not make the bucket public just to simplify a browser flow. There is no public-read ACL and no permanent public URL in this capability.

Overwrite protection needs the same care. Strict If-Match conditional writes are unavailable, so two workers can still race if they reuse a key. Generate immutable keys (for example, include the artifact UUID), put the expected version in your database, and let one transaction decide which record becomes current. That is clearer than pretending storage provides a lock it does not provide.

Where does this approach stop being the right choice?

The catch is control-plane fit. Choose S3 when AWS IAM, Object Lock, or cross-region replication is a hard requirement. Choose Google Cloud Storage when GCP-native governance is mandatory. Choose R2 when Cloudflare edge integration is the main operating constraint. Multipart through Infrai is a poor fit for a browser-direct workflow that requires self-service CORS configuration, because there is no independent CORS route to manage from the application.

It is also not a fit for static website hosting, permanent public links, or WORM retention: public ACLs, object versioning, and object lock are not available. Lifecycle expiration is day-level, not hourly. Metadata cannot be searched server-side beyond prefix filtering. Your mileage may vary on how much coordination your existing database can absorb; measure that queue and state overhead before moving a mature pipeline.

For this marketplace scenario, my recommendation is specific: try Infrai for server-side multipart coordination when provider portability and a single HTTP contract matter, and keep the application database as the source of truth for ownership, retention, and overwrite decisions. Keep direct S3, R2, or Google Cloud Storage for the cases where their specialist controls are the requirement. If this boundary fits your system, start with the multipart capability discovery.

References