import DownloadedResource from '@mapcreator/api/src/resources/base/DownloadedResource.js'
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 |
Get the size of the data |
|
public get |
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:
Name | Type | Attribute | Description |
response | Response | Response |
Public Constructors
public constructor(data: ArrayBuffer | Buffer, type: string, fileName: string) source
Params:
Name | Type | Attribute | Description |
data | ArrayBuffer | Buffer | Data |
|
type | string |
|
Mime-type |
fileName | string |
|
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
Public Methods
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.