Picadabra Docs

Storage

File upload and management with presigned URLs.

client.storage.upload()

Upload a file directly.

const  = new (['content'], 'hello.txt', { : 'text/plain' })

const  = await ..({  })
// result.key - storage key
// result.url - public URL

client.storage.createUploadUrl()

Get a presigned URL for client-side uploads (better for large files).

const { ,  } = await ..({
	: 'video.mp4',
	: 'video/mp4',
	: '1h', // '1h' | '1d' | '7d' | '30d' | '1y' | 'never'
})

// Upload directly to presigned URL
await (, { : 'PUT', :  })

client.storage.createMultipartUpload()

Initiate multipart upload for very large files (>100MB).

const { ,  } = await ..({
	: 'large-file.zip',
	: 'application/zip',
})

client.storage.getPartUploadUrl()

Get upload URL for a specific part in multipart upload.

const {  } = await ..({
	,
	,
	: 1,
})

client.storage.completeMultipartUpload()

Complete a multipart upload after all parts are uploaded.

const  = await ..({
	,
	,
	: [
		{ : 1, : 'etag1' },
		{ : 2, : 'etag2' },
	],
})

client.storage.getDownloadUrl()

Get a presigned download URL.

const { ,  } = await ..({
	: 'documents/report.pdf',
	: '1d',
})

client.storage.get()

Get metadata for a stored object.

const  = await ..({ : 'images/photo.jpg' })
// obj.size, obj.contentType, obj.createdAt

client.storage.list()

List objects with optional prefix filter.

const { , ,  } = await ..({
	: 'images/',
	: 20,
})

client.storage.delete()

Delete a stored object.

await ..({ : 'temp/file.txt' })

How is this guide?