Skip to main content

AttachmentTransportAdapter

Experimental Alpha

AttachmentTransportAdapter owns all remote-side operations for an attachment — transfer (upload/download) and delete — as single operations.

A transport owns the entire transfer, letting implementations pick the most efficient mechanism available (buffer, stream, or a platform-native file-URI upload/download API). On platforms like React Native this allows large files to be transferred without ever materializing them in the JS heap.

The default transport composes the local and remote storage adapters. Provide a custom transport (via AttachmentQueue's transportAdapter option) to own the whole remote side; in that case a separate remoteStorage is not required.

This is currently experimental and may change without a major version bump.

Methods

delete()

delete(attachment): Promise<void>;

Alpha

Deletes the attachment's file from remote storage. Local file removal is handled separately by the syncing service.

Parameters

ParameterTypeDescription
attachmentAttachmentRecordThe attachment to delete.

Returns

Promise<void>


download()

download(attachment): Promise<void>;

Alpha

Downloads the remote file into attachment.localUri.

Parameters

ParameterTypeDescription
attachmentLocatedAttachmentRecordThe attachment to download. localUri is the destination path, assigned by the syncing service before this call.

Returns

Promise<void>


upload()

upload(attachment): Promise<void>;

Alpha

Uploads the attachment's local file to remote storage.

Parameters

ParameterTypeDescription
attachmentLocatedAttachmentRecordThe attachment to upload. localUri points at the source file.

Returns

Promise<void>