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)| Parameter | Type | Description |
|---|---|---|
config | PinnerConfig | SDK configuration object |
Methods
| Method | Returns | Description |
|---|---|---|
pins() | RemotePins | Access the remote pins interface. |
ipns() | IpnsClient | Access the IPNS interface for key management and publishing. |
websites() | WebsitesClient | Access the websites interface for website configuration and management. |
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 |
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() | void | Destroy the client and cleanup resources. |
pins()
pins(): RemotePinsAccess the remote pins interface.
Returns: RemotePins
ipns()
ipns(): IpnsClientAccess the IPNS interface for key management and publishing.
Returns: IpnsClient
websites()
websites(): WebsitesClientAccess the websites interface for website configuration and management.
Returns: WebsitesClient
upload()
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
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:
| Name | Type | Description |
|---|---|---|
file | File | The file to upload |
options | UploadOptions | Upload 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:
| Name | Type | Description |
|---|---|---|
input | number | UploadResult | Either an operation ID (number) or an UploadResult |
options | any | Polling options (interval, timeout, settledStates) optional |
Returns: Promise<UploadResult>
uploadDirectory(files, options?)
uploadDirectory(files: File[], options?: UploadOptions): Promise<UploadOperation>Upload a directory to IPFS.
Parameters:
| Name | Type | Description |
|---|---|---|
files | File[] | Array of files to upload as a directory |
options | UploadOptions | Upload 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:
| Name | Type | Description |
|---|---|---|
file | File | ReadableStream<Uint8Array<ArrayBufferLike>> | CAR file or stream to upload |
options | UploadOptions | Upload 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:
| Name | Type | Description |
|---|---|---|
cid | string | CID<unknown, number, number, Version> | CID of content to pin (string or CID object) |
options | RemoteAddOptions | Remote add options optional |
Returns: Promise<AsyncGenerator<…>>
listPins(options?)
listPins(options?: RemoteLsOptions): Promise<RemotePin[]>List pinned content.
Parameters:
| Name | Type | Description |
|---|---|---|
options | RemoteLsOptions | List filtering options optional |
Returns: Promise<RemotePin[]>
getPinStatus(cid)
getPinStatus(cid: string | CID<unknown, number, number, Version>): Promise<RemotePin>Get pin status.
Parameters:
| Name | Type | Description |
|---|---|---|
cid | string | 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:
| Name | Type | Description |
|---|---|---|
cid | string | 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:
| Name | Type | Description |
|---|---|---|
cid | string | CID<unknown, number, number, Version> | CID of the pin |
metadata | Record<string, string> | undefined | Key-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:
| Name | Type | Description |
|---|---|---|
cid | string | CID<unknown, number, number, Version> | CID to unpin |
options | AbortOptions | Abort 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:
| Name | Type | Description |
|---|---|---|
requestId | string | The request ID to remove |
options | AbortOptions | Abort options optional |
Returns: Promise<void>
destroy()
destroy(): voidDestroy the client and cleanup resources.
Returns: void
Source: pinner.ts