• default
    • DigitalAssets


  • Parameters

    • __namedParameters: EndpointOptions

    Returns DigitalAssets


  • 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


    // 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()


    // Convert a stream to a Blob for easier processing.
    const digitalAssetBlob = await new Response(digitalAssetStream).blob()

    image.src = URL.createObjectURL(digitalAssetBlob)


    • options: DownloadOptions

    Returns Promise<DigitalAssetResult>

  • Type Parameters

    • ResponseType = JsonApiResponse


    • method: HttpMethod
    • url: string
    • Optional tokens: IToken
    • Optional params: any
    • Optional responseParsing: ResponseParsing

    Returns Promise<ResultResponse<ResponseType>>

  • 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.


    • error: default

    Returns ErrorType

  • Parameters

    • error: Error

    Returns default

  • Parameters

    • error: default

    Returns default

  • Parameters

    • tokens: IToken

    Returns {
        [headerName: string]: string;

    • [headerName: string]: string


fetcher: Fetcher

Generated using TypeDoc