Skip to content
scroll to zoom · drag to pan

UploadTaskOptions

type UploadTaskOptions = {
apiHeaders?: Record<string, string>;
authToken?: string;
concurrency?: number;
endpoint: string;
fetch?: typeof fetch;
file: UploadFileInput;
originalBytes?: number;
partConcurrency?: number;
partSize?: number;
presets?: string[];
resumeFrom?: UploadRecord;
retry?: Partial<RetryPolicy>;
sleep?: (ms) => Promise<void>;
store?: RecordStore;
tenantCode: string;
visibility?: "public" | "private";
};

Defined in: packages/asset-uploader-expo/src/types.ts:74

optional apiHeaders?: Record<string, string>;

Defined in: packages/asset-uploader-expo/src/types.ts:88

Extra headers sent ONLY on the asset-manager API calls (/assets/upload-url, multipart init/complete, etc.) — never on the direct R2 byte PUT, whose headers come from the presign response. Used by Expo clients to attach the Better Auth session Cookie (the documented Expo auth pattern), since the native uploader can’t send cookies automatically.


optional authToken?: string;

Defined in: packages/asset-uploader-expo/src/types.ts:80

Optional bearer token (proxy normally injects this on the wire).


optional concurrency?: number;

Defined in: packages/asset-uploader-expo/src/types.ts:94


endpoint: string;

Defined in: packages/asset-uploader-expo/src/types.ts:78

Asset-manager API base URL. Same field as web.


optional fetch?: typeof fetch;

Defined in: packages/asset-uploader-expo/src/types.ts:108

Injectable for tests.


file: UploadFileInput;

Defined in: packages/asset-uploader-expo/src/types.ts:75


optional originalBytes?: number;

Defined in: packages/asset-uploader-expo/src/types.ts:129

Pre-compression byte count from the client. Forwarded to the server so the asset detail UI can show the savings ratio. Set to the size BEFORE any client-side compression. If you didn’t compress (or the compression inflated and you fell back to the original), pass file.size here so original == uploaded.


optional partConcurrency?: number;

Defined in: packages/asset-uploader-expo/src/types.ts:92

Parts in flight at once. Default 2 — low-end Android runs out of memory with more.


optional partSize?: number;

Defined in: packages/asset-uploader-expo/src/types.ts:90

Multipart part size. Default 10 MiB on mobile (server range 5 MiB–5 GiB).


optional presets?: string[];

Defined in: packages/asset-uploader-expo/src/types.ts:121

Variant presets to generate server-side — e.g. the image responsive ladder ["thumb","sm","md","lg","xl"] or video ["poster","video","aiproxy","probe"]. Forwarded to /assets/upload-url and /assets/multipart/initiate. Omit to inherit the server default (currently ["original"] only — meaning responsive/poster variants won’t exist and gallery URLs will 404). The high-level aq.upload(file, { presets }) sends this; the low-level UploadTask needs it passed explicitly. Kept as string[] (server validates names) so newer presets like probe don’t need a type bump.


optional resumeFrom?: UploadRecord;

Defined in: packages/asset-uploader-expo/src/types.ts:106

Continue a persisted upload. Use UploadTask.fromRecord / resumePending.


optional retry?: Partial<RetryPolicy>;

Defined in: packages/asset-uploader-expo/src/types.ts:96

Backoff policy for every transfer and API call. Defaults in DEFAULT_RETRY_POLICY.


optional sleep?: (ms) => Promise<void>;

Defined in: packages/asset-uploader-expo/src/types.ts:110

Injectable for tests.

Parameter Type
ms number

Promise<void>


optional store?: RecordStore;

Defined in: packages/asset-uploader-expo/src/types.ts:104

Durable record storage. Default: native (survives kill and reboot).


tenantCode: string;

Defined in: packages/asset-uploader-expo/src/types.ts:76


optional visibility?: "public" | "private";

Defined in: packages/asset-uploader-expo/src/types.ts:102

Private at upload. "private" is sent to /assets/upload-url / /assets/multipart/initiate and persisted before a byte is uploaded, so the asset is born private. Omit → the tenant default.