downloadAndValidateFromUrl
function downloadAndValidateFromUrl(url, expectedPieceCid): Promise<Uint8Array<ArrayBufferLike>>;Defined in: packages/synapse-sdk/src/piece/download.ts:125
Download data from a URL, validate its PieceCID, and return as Uint8Array
This is a convenience function that fetches from a URL and then uses downloadAndValidate to download and validate the data.
Parameters
Section titled “Parameters”| Parameter | Type | Description | 
|---|---|---|
url | string | The URL to download from | 
expectedPieceCid | string | PieceLink | The expected PieceCID to validate against | 
Returns
Section titled “Returns”Promise<Uint8Array<ArrayBufferLike>>
The downloaded data as a Uint8Array
Throws
Section titled “Throws”Error if PieceCID validation fails or download errors occur
Example
Section titled “Example”const data = await downloadAndValidateFromUrl(  'https://provider.com/piece/bafkzcib...',  'bafkzcib...')