Skip to content
LogoLogo

This page is auto-generated from TypeDoc. Do not edit directly. To update, modify the TypeScript source in @lumeweb/pinner and run pnpm generate:sdk.

Handles file uploads via XHR or TUS protocol based on file size.

Constructor

new UploadManager(config: PinnerConfig)
ParameterTypeDescription
configPinnerConfigSDK configuration

Methods

MethodReturnsDescription
fetchUploadLimit()Promise<number>Fetch the upload size limit from the API. Falls back to 100 MB on failure.
getUploadLimit()numberGet the cached upload size limit (in bytes). Call fetchUploadLimit() first.
upload(input, options)Promise<UploadOperation>Upload a file or stream to IPFS.
uploadCar(input, options)Promise<UploadOperation>Upload a CAR file or stream directly without preprocessing.
waitForOperation(input, options)Promise<UploadResult>Wait for an operation to complete or reach a settled state. Handles two scenarios: 1. If an operationId is provided (in UploadResult), uses it directly 2. If only CID is available, lists operations filtered by CID and polls the first result
uploadDirectory(files, options)Promise<UploadOperation>Upload an array of files as an IPFS directory.
destroy()void

fetchUploadLimit()

fetchUploadLimit(): Promise<number>

Fetch the upload size limit from the API. Falls back to 100 MB on failure.

Returns: Promise<number>

getUploadLimit()

getUploadLimit(): number

Get the cached upload size limit (in bytes). Call fetchUploadLimit() first.

Returns: number

upload(input, options?)

upload(input: UploadInput, options?: UploadOptions): Promise<UploadOperation>

Upload a file or stream to IPFS.

Parameters:

NameTypeDescription
inputUploadInputFile, stream, or upload object
optionsUploadOptionsUpload configuration optional

Returns: Promise<UploadOperation>

uploadCar(input, options?)

uploadCar(input: File | ReadableStream<Uint8Array<ArrayBufferLike>>, options?: UploadOptions): Promise<UploadOperation>

Upload a CAR file or stream directly without preprocessing.

Parameters:

NameTypeDescription
inputFile | ReadableStream<Uint8Array<ArrayBufferLike>>CAR file or stream
optionsUploadOptionsUpload configuration optional

Returns: Promise<UploadOperation>

waitForOperation(input, options?)

waitForOperation(input: number | UploadResult, options?: any): Promise<UploadResult>

Wait for an operation to complete or reach a settled state.

Handles two scenarios:

  1. If an operationId is provided (in UploadResult), uses it directly

  2. If only CID is available, lists operations filtered by CID and polls the first result

Parameters:

NameTypeDescription
inputnumber | UploadResultEither an operation ID (number) or an UploadResult
optionsanyPolling options (interval, timeout, settledStates) optional

Returns: Promise<UploadResult>

uploadDirectory(files, options?)

uploadDirectory(files: File[], options?: UploadOptions): Promise<UploadOperation>

Upload an array of files as an IPFS directory.

Parameters:

NameTypeDescription
filesFile[]Files to upload
optionsUploadOptionsUpload configuration optional

Returns: Promise<UploadOperation>

destroy()

destroy(): void

Returns: void


Source: upload/manager.ts