findPiece
Defined in: packages/synapse-core/src/sp/find-piece.ts:65
Find a piece on the PDP API.
GET /pdp/piece?pieceCid={pieceCid}
Transient failures (5xx, 429, network errors) are retried. HTTP errors and timeouts are thrown as
FindPieceError with the original error as cause; notFound tells a missing piece apart
from other failures.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options |
OptionsType |
findPiece.OptionsType |
Returns
Section titled “Returns”Piece CID findPiece.OutputType
Example
Section titled “Example”import * as SP from '@filoz/synapse-core/sp'
import * as Piece from '@filoz/synapse-core/piece'
// wait for an uploaded piece to be parked
const pieceCid = await SP.findPiece({
serviceURL: 'https://pdp.example.com',
pieceCid: Piece.from('bafkzcib...'),
poll: true,
})Throws
Section titled “Throws”Errors findPiece.ErrorType