Home Manual Reference Source Repository
public class | source

DownloadedResource

Downloaded resource from the api

Static Method Summary

Static Public Methods
public static

async fromResponse(response: Response): DownloadedResource

Build instance from response

Constructor Summary

Public Constructor
public

constructor(data: ArrayBuffer | Buffer, type: string, fileName: string)

Member Summary

Public Members
public get

data: ArrayBuffer | Buffer: *

In Nodejs it will return a Buffer and in the browser it will respond with a ArrayBuffer

public get

Resource file name, if available

public get

size: Number: *

Get the size of the data

public get

type: string: *

Resource mime-type

Method Summary

Public Methods
public

createBlob(): Blob

Create a blob from the resource

public

Create a object url The URL lifetime is tied to the document in the window on which it was created.

public

Base64 encode data

public

Get base64-encoded data uri

public

toString(): *

Static Public Methods

public static async fromResponse(response: Response): DownloadedResource source

Build instance from response

Params:

NameTypeAttributeDescription
response Response

Response

Return:

DownloadedResource

Instance

Public Constructors

public constructor(data: ArrayBuffer | Buffer, type: string, fileName: string) source

Params:

NameTypeAttributeDescription
data ArrayBuffer | Buffer

Data

type string
  • optional
  • default: application/octet-stream

Mime-type

fileName string
  • optional
  • default: Untitled

File name

Public Members

public get data: ArrayBuffer | Buffer: * source

In Nodejs it will return a Buffer and in the browser it will respond with a ArrayBuffer

Return:

ArrayBuffer | Buffer

Resource data

public get fileName: string: * source

Resource file name, if available

Return:

string

File name

public get size: Number: * source

Get the size of the data

Return:

Number

Size in bytes

public get type: string: * source

Resource mime-type

Return:

string

Mime-type

Public Methods

public createBlob(): Blob source

Create a blob from the resource

Return:

Blob

public createObjectUrl(): string source

Create a object url The URL lifetime is tied to the document in the window on which it was created. The new object URL represents the resource. Do not forget to release the object urls once used.

Return:

string

Object url

See:

public toBase64(): string source

Base64 encode data

Return:

string

Base64 encoded data

public toDataUri(): string source

Get base64-encoded data uri

Return:

string

Data uri

See:

public toString(): * source

Return:

*