UNPKG

filecoin-pin

Version:

Bridge IPFS content to Filecoin Onchain Cloud using familiar tools

31 lines 1.14 kB
import { getDataSetPieces } from './get-data-set-pieces.js'; import { listDataSets } from './list-data-sets.js'; export async function getDetailedDataSet(synapse, dataSetId, options) { const logger = options?.logger; const dataSets = await listDataSets(synapse, { ...options, withProviderDetails: true, filter: (dataSet) => dataSet.pdpVerifierDataSetId === dataSetId, }); const dataSet = dataSets[0]; if (dataSets.length === 0 || dataSet == null) { logger?.error({ dataSetId }, `Data set ${dataSetId} not found`); throw new Error(`Data set ${dataSetId} not found`); } const storageContext = await synapse.storage.createContext({ dataSetId: dataSet.dataSetId, }); const piecesResult = await getDataSetPieces(synapse, storageContext, { includeMetadata: true, logger, }); const result = { ...dataSet, pieces: piecesResult.pieces, }; if (piecesResult.totalSizeBytes != null) { result.totalSizeBytes = piecesResult.totalSizeBytes; } return result; } //# sourceMappingURL=get-detailed-data-set.js.map