Returns a stream for downloading a purchased digital product. See api docs.
Required token: Bearer token or Order token
Options schema:
interface options { asset_token: string}
Success response schema: Success schema
Failure response schema: Error schema
Example:
// Many NodeJS servers allow piping a stream as the response (`digitalAssetStream.pipe(serverResponse);`).// The below example assumes a logged in user using SpreeSDK in the browser and downloading an image asset.// A digital token can be retrieved from a digital link associated to a line item in a completed order.const digitalToken = '1YjXK36ZRj2w4nxtMkJutTGX'const response = await client.digitalAssets.download({ bearer_token: '7381273269536713689562374856', asset_token: digitalToken})const digitalAssetStream = response.success()// Append an <img> tag to the page to show the asset on the page.const image = new Image()document.body.appendChild(image)// Convert a stream to a Blob for easier processing.const digitalAssetBlob = await new Response(digitalAssetStream).blob()image.src = URL.createObjectURL(digitalAssetBlob)
Protected
Optional
The HTTP error code returned by Spree is not indicative of its response shape. This function determines the information provided by Spree and uses everything available.
Generated using TypeDoc
Returns a stream for downloading a purchased digital product. See api docs.
Required token: Bearer token or Order token
Options schema:
Success response schema: Success schema
Failure response schema: Error schema
Example: