Skip to content

StorageManager

Defined in: packages/synapse-sdk/src/storage/manager.ts:87

new StorageManager(
synapse,
warmStorageService,
pieceRetriever,
withCDN,
dev,
withIpni?): StorageManager;

Defined in: packages/synapse-sdk/src/storage/manager.ts:96

ParameterType
synapseSynapse
warmStorageServiceWarmStorageService
pieceRetrieverPieceRetriever
withCDNboolean
devboolean
withIpni?boolean

StorageManager

createContext(options?): Promise<StorageContext>;

Defined in: packages/synapse-sdk/src/storage/manager.ts:247

Create a new storage context with specified options

ParameterType
options?StorageServiceOptions

Promise<StorageContext>


createContexts(options?): Promise<StorageContext[]>;

Defined in: packages/synapse-sdk/src/storage/manager.ts:235

ParameterType
options?CreateContextsOptions

Promise<StorageContext[]>


download(pieceCid, options?): Promise<Uint8Array<ArrayBufferLike>>;

Defined in: packages/synapse-sdk/src/storage/manager.ts:152

Download data from storage If context is provided, routes to context.download() Otherwise performs SP-agnostic download

ParameterType
pieceCidstring | PieceLink
options?StorageManagerDownloadOptions

Promise<Uint8Array<ArrayBufferLike>>


findDataSets(clientAddress?): Promise<EnhancedDataSetInfo[]>;

Defined in: packages/synapse-sdk/src/storage/manager.ts:328

Query data sets for this client

ParameterTypeDescription
clientAddress?stringOptional client address, defaults to current signer

Promise<EnhancedDataSetInfo[]>

Array of enhanced data set information including management status


getDefaultContext(): Promise<StorageContext>;

Defined in: packages/synapse-sdk/src/storage/manager.ts:319

Get or create the default context

Promise<StorageContext>


getStorageInfo(): Promise<StorageInfo>;

Defined in: packages/synapse-sdk/src/storage/manager.ts:348

Get comprehensive information about the storage service including approved providers, pricing, contract addresses, and current allowances

Promise<StorageInfo>

Complete storage service information


preflightUpload(size, options?): Promise<PreflightInfo>;

Defined in: packages/synapse-sdk/src/storage/manager.ts:213

Run preflight checks for an upload without creating a context

ParameterTypeDescription
sizenumberThe size of data to upload in bytes
options?{ metadata?: Record<string, string>; withCDN?: boolean; }Optional settings including withCDN flag and/or metadata
options.metadata?Record<string, string>-
options.withCDN?boolean-

Promise<PreflightInfo>

Preflight information including costs and allowances


terminateDataSet(dataSetId): Promise<TransactionResponse>;

Defined in: packages/synapse-sdk/src/storage/manager.ts:339

Terminate a data set with given ID that belongs to the synapse signer. This will also result in the removal of all pieces in the data set.

ParameterTypeDescription
dataSetIdnumberThe ID of the data set to terminate

Promise<TransactionResponse>

Transaction response


upload(data, options?): Promise<UploadResult>;

Defined in: packages/synapse-sdk/src/storage/manager.ts:117

Upload data to storage If context is provided, routes to context.upload() Otherwise creates/reuses default context

ParameterType
data| ArrayBuffer | Uint8Array<ArrayBufferLike>
options?StorageManagerUploadOptions

Promise<UploadResult>