Skip to main content
Use direct transfers when your application already has the bytes in memory. Use presigned URLs when you want a simple HTTP upload or download flow outside the SDK runtime client.

Direct Upload And Download

const uploaded = await sandbox.files.upload("/tmp/data/upload.txt", "uploaded body");
const downloaded = await sandbox.files.download("/tmp/data/upload.txt");

console.log(uploaded.bytesWritten);
console.log(downloaded.toString("utf8"));

Presigned Upload And Download URLs

const upload = await sandbox.files.uploadUrl("/tmp/presigned.txt", {
  oneTime: true,
  expiresInSeconds: 60,
});

const download = await sandbox.files.downloadUrl("/tmp/presigned.txt", {
  oneTime: true,
  expiresInSeconds: 60,
});

console.log(upload.method, upload.url);
console.log(download.method, download.url);

Choosing Between Direct And Presigned Transfers

Use direct upload and download when:
  • The SDK client already owns the bytes.
  • You want the simplest in-process transfer path.
  • You do not need to hand off the transfer to another service.
Use presigned URLs when:
  • You want plain HTTP transfer behavior.
  • Another service or worker should perform the upload or download.
  • You want one-time or explicitly expiring transfer links.

One-Time URLs

One-time presigned URLs are supported for both upload and download. Only one concurrent request should succeed for a given one-time URL. Use this mode when you want handoff semantics rather than reusable access.