StorageManagerUploadOptions
Defined in: packages/synapse-sdk/src/storage/manager.ts:120
Upload options for StorageManager.upload()
Extends CreateContextsOptions to inherit multi-copy provider selection. Adds upload-specific options: explicit contexts, pre-calculated PieceCID, and abort signal.
Usage patterns:
- With explicit contexts:
{ contexts }- uses the given contexts directly - Auto-create contexts:
{ providerIds?, dataSetIds?, copies? }- creates/reuses contexts - Use default contexts: no options - uses cached default contexts (2 copies)
Extends
Section titled “Extends”Properties
Section titled “Properties”callbacks?
Section titled “callbacks?”
optionalcallbacks?:Partial<CombinedCallbacks>
Defined in: packages/synapse-sdk/src/storage/manager.ts:125
Callbacks for both context creation and upload lifecycle
Overrides
Section titled “Overrides”CreateContextsOptions.callbacks
contexts?
Section titled “contexts?”
optionalcontexts?:StorageContext[]
Defined in: packages/synapse-sdk/src/storage/manager.ts:122
Pre-created contexts to use. If provided, other selection options are invalid.
copies?
Section titled “copies?”
optionalcopies?:number
Defined in: packages/synapse-sdk/src/types.ts:378
Number of storage copies to create (optional, defaults to 2)
Inherited from
Section titled “Inherited from”dataSetIds?
Section titled “dataSetIds?”
optionaldataSetIds?:bigint[]
Defined in: packages/synapse-sdk/src/types.ts:388
Specific data set IDs to target. Each must be an active data set owned by
the caller. Mutually exclusive with providerIds.
Use this only when resuming into a known data set from a prior operation.
For first-time uploads to specific providers, use providerIds instead,
the SDK handles data set creation automatically.
Inherited from
Section titled “Inherited from”CreateContextsOptions.dataSetIds
excludeProviderIds?
Section titled “excludeProviderIds?”
optionalexcludeProviderIds?:bigint[]
Defined in: packages/synapse-sdk/src/types.ts:406
Do not select any of these providers
Inherited from
Section titled “Inherited from”CreateContextsOptions.excludeProviderIds
metadata?
Section titled “metadata?”
optionalmetadata?:Record<string,string>
Defined in: packages/synapse-sdk/src/types.ts:359
Custom metadata for data sets (key-value pairs). Used to match existing data sets during provider selection.
Inherited from
Section titled “Inherited from”CreateContextsOptions.metadata
pieceCid?
Section titled “pieceCid?”
optionalpieceCid?:PieceCID
Defined in: packages/synapse-sdk/src/storage/manager.ts:128
Optional pre-calculated PieceCID to skip CommP calculation (verified by server)
pieceMetadata?
Section titled “pieceMetadata?”
optionalpieceMetadata?:Record<string,string>
Defined in: packages/synapse-sdk/src/storage/manager.ts:134
Custom metadata for pieces being uploaded (key-value pairs)
providerIds?
Section titled “providerIds?”
optionalproviderIds?:bigint[]
Defined in: packages/synapse-sdk/src/types.ts:403
Specific provider IDs to upload to. The SDK resolves or creates data sets
on each provider automatically. Mutually exclusive with dataSetIds.
This is the recommended way to target specific providers. Do not call
createContext() to resolve data sets first, pass provider IDs here
and the SDK handles the rest.
Example
Section titled “Example”Upload to two specific providers
await synapse.storage.upload(data, { providerIds: [4n, 9n] })Inherited from
Section titled “Inherited from”CreateContextsOptions.providerIds
signal?
Section titled “signal?”
optionalsignal?:AbortSignal
Defined in: packages/synapse-sdk/src/storage/manager.ts:131
Optional AbortSignal to cancel the upload
withCDN?
Section titled “withCDN?”
optionalwithCDN?:boolean
Defined in: packages/synapse-sdk/src/types.ts:353
Whether to enable CDN services