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.

Constructor

new Pinner(config: PinnerConfig)
ParameterTypeDescription
configPinnerConfigSDK configuration object

Methods

MethodReturnsDescription
pins()RemotePinsAccess the remote pins interface.
ipns()IpnsClientAccess the IPNS interface for key management and publishing.
websites()WebsitesClientAccess the websites interface for website configuration and management.
upload()UploadMethodAndBuilderUpload interface that works as both a method and a builder namespace. As a method: upload(file, options) -> UploadOperation As a property: upload.file(), upload.json(), etc. -> Builder
uploadAndWait(file, options)Promise<UploadResult>Upload a file and wait for completion. Convenience method for simple use cases where controls aren't needed.
waitForOperation(input, options)Promise<UploadResult>Wait for an operation to complete or reach a settled state.
uploadDirectory(files, options)Promise<UploadOperation>Upload a directory to IPFS.
uploadCar(file, options)Promise<UploadOperation>Upload a CAR file without preprocessing. This is useful for passthrough of pre-generated CAR files.
pinByHash(cid, options)Promise<AsyncGenerator<…>>Pin existing content by CID.
listPins(options)Promise<RemotePin[]>List pinned content.
getPinStatus(cid)Promise<RemotePin>Get pin status.
isPinned(cid)Promise<boolean>Check if content is pinned.
setPinMetadata(cid, metadata)Promise<void>Update pin metadata.
unpin(cid, options)Promise<void>Remove a pin. The block may be deleted when garbage collection is run.
unpinByRequestId(requestId, options)Promise<void>Remove a pin by request ID. The block may be deleted when garbage collection is run.
destroy()voidDestroy the client and cleanup resources.

pins()

pins(): RemotePins

Access the remote pins interface.

Returns: RemotePins

ipns()

ipns(): IpnsClient

Access the IPNS interface for key management and publishing.

Returns: IpnsClient

websites()

websites(): WebsitesClient

Access the websites interface for website configuration and management.

Returns: WebsitesClient

upload()

upload(): UploadMethodAndBuilder

Upload interface that works as both a method and a builder namespace.

As a method: upload(file, options) -> UploadOperation

As a property: upload.file(), upload.json(), etc. -> Builder

Returns: UploadMethodAndBuilder

uploadAndWait(file, options?)

uploadAndWait(file: File, options?: UploadOptions): Promise<UploadResult>

Upload a file and wait for completion.

Convenience method for simple use cases where controls aren't needed.

Parameters:

NameTypeDescription
fileFileThe file to upload
optionsUploadOptionsUpload configuration optional

Returns: Promise<UploadResult>

waitForOperation(input, options?)

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

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

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 a directory to IPFS.

Parameters:

NameTypeDescription
filesFile[]Array of files to upload as a directory
optionsUploadOptionsUpload configuration optional

Returns: Promise<UploadOperation>

uploadCar(file, options?)

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

Upload a CAR file without preprocessing.

This is useful for passthrough of pre-generated CAR files.

Parameters:

NameTypeDescription
fileFile | ReadableStream<Uint8Array<ArrayBufferLike>>CAR file or stream to upload
optionsUploadOptionsUpload configuration optional

Returns: Promise<UploadOperation>

pinByHash(cid, options?)

pinByHash(cid: string | CID<unknown, number, number, Version>, options?: RemoteAddOptions): Promise<AsyncGenerator<CID<unknown, number, number, Version>, void, undefined>>

Pin existing content by CID.

Parameters:

NameTypeDescription
cidstring | CID<unknown, number, number, Version>CID of content to pin (string or CID object)
optionsRemoteAddOptionsRemote add options optional

Returns: Promise<AsyncGenerator<…>>

listPins(options?)

listPins(options?: RemoteLsOptions): Promise<RemotePin[]>

List pinned content.

Parameters:

NameTypeDescription
optionsRemoteLsOptionsList filtering options optional

Returns: Promise<RemotePin[]>

getPinStatus(cid)

getPinStatus(cid: string | CID<unknown, number, number, Version>): Promise<RemotePin>

Get pin status.

Parameters:

NameTypeDescription
cidstring | CID<unknown, number, number, Version>CID of the pinned content to check

Returns: Promise<RemotePin>

isPinned(cid)

isPinned(cid: string | CID<unknown, number, number, Version>): Promise<boolean>

Check if content is pinned.

Parameters:

NameTypeDescription
cidstring | CID<unknown, number, number, Version>CID to check

Returns: Promise<boolean>

setPinMetadata(cid, metadata)

setPinMetadata(cid: string | CID<unknown, number, number, Version>, metadata: Record<string, string> | undefined): Promise<void>

Update pin metadata.

Parameters:

NameTypeDescription
cidstring | CID<unknown, number, number, Version>CID of the pin
metadataRecord<string, string> | undefinedKey-value metadata to set

Returns: Promise<void>

unpin(cid, options?)

unpin(cid: string | CID<unknown, number, number, Version>, options?: AbortOptions): Promise<void>

Remove a pin. The block may be deleted when garbage collection is run.

Parameters:

NameTypeDescription
cidstring | CID<unknown, number, number, Version>CID to unpin
optionsAbortOptionsAbort options optional

Returns: Promise<void>

unpinByRequestId(requestId, options?)

unpinByRequestId(requestId: string, options?: AbortOptions): Promise<void>

Remove a pin by request ID. The block may be deleted when garbage collection is run.

Parameters:

NameTypeDescription
requestIdstringThe request ID to remove
optionsAbortOptionsAbort options optional

Returns: Promise<void>

destroy()

destroy(): void

Destroy the client and cleanup resources.

Returns: void


Source: pinner.ts