@bitbybit-dev/core
Version:
Bit By Bit Developers Core CAD API to Program Geometry
142 lines (141 loc) • 4.78 kB
TypeScript
import * as Inputs from "../inputs";
import { AssetManager } from "../../asset-manager";
export declare class Asset {
assetManager: AssetManager;
constructor();
/**
* Gets the asset file
* @param inputs file name to get from project assets
* @returns Blob of asset
* @group get
* @shortname cloud file
*/
getFile(inputs: Inputs.Asset.GetAssetDto): Promise<File>;
/**
* Gets the text from asset file stored in your cloud account.
* @param inputs asset name to get from project assets
* @returns Text of asset
* @group get
* @shortname text file
*/
getTextFile(inputs: Inputs.Asset.GetAssetDto): Promise<string>;
/**
* Gets the local asset file stored in your browser.
* @param inputs asset name to get from local assets
* @returns Blob of asset
* @group get
* @shortname local file
*/
getLocalFile(inputs: Inputs.Asset.GetAssetDto): Promise<File | File[]>;
/**
* Gets the text from asset file stored in your browser.
* @param inputs asset name to get from local assets
* @returns Text of asset or array of texts
* @group get
* @shortname local text file
*/
getLocalTextFile(inputs: Inputs.Asset.GetAssetDto): Promise<string | string[]>;
/**
* Fetches the blob from the given url, must be CORS enabled accessible endpoint
* @param inputs url of the asset
* @returns Blob
* @group fetch
* @shortname fetch blob
*/
fetchBlob(inputs: Inputs.Asset.FetchDto): Promise<Blob>;
/**
* Fetches the file from the given url, must be CORS enabled accessible endpoint
* @param inputs url of the asset
* @returns File
* @group fetch
* @shortname fetch file
*/
fetchFile(inputs: Inputs.Asset.FetchDto): Promise<File>;
/**
* Fetches the json from the given url, must be CORS enabled accessible endpoint
* @param inputs url of the asset
* @returns JSON
* @group fetch
* @shortname fetch json
*/
fetchJSON(inputs: Inputs.Asset.FetchDto): Promise<any>;
/**
* Fetches the json from the given url, must be CORS enabled accessible endpoint
* @param inputs url of the asset
* @returns Text
* @group fetch
* @shortname fetch text
*/
fetchText(inputs: Inputs.Asset.FetchDto): Promise<string>;
/**
* Gets and creates the url string path to your file stored in your memory.
* @param File or a blob
* @returns URL string of a file
* @group create
* @shortname object url
*/
createObjectURL(inputs: Inputs.Asset.FileDto): string;
/**
* Gets and creates the url string paths to your files stored in your memory.
* @param Files or a blobs
* @returns URL strings for given files
* @group create
* @shortname object urls
*/
createObjectURLs(inputs: Inputs.Asset.FilesDto): string[];
/**
* Downloads a file with the given content, extension, and content type.
* @param inputs file name, content, extension, and content type
* @group download
* @shortname download file
*/
download(inputs: Inputs.Asset.DownloadDto): void;
/**
* Converts a File or Blob to an ArrayBuffer.
* @param inputs file or blob to convert
* @returns ArrayBuffer
* @group convert
* @shortname to array buffer
*/
toArrayBuffer(inputs: Inputs.Asset.FileDto): Promise<ArrayBuffer>;
/**
* Converts a File or Blob to a Uint8Array.
* @param inputs file or blob to convert
* @returns Uint8Array
* @group convert
* @shortname to uint8 array
*/
toUint8Array(inputs: Inputs.Asset.FileDto): Promise<Uint8Array>;
/**
* Converts a Blob to a File.
* @param inputs blob, file name, and optional MIME type
* @returns File
* @group convert
* @shortname blob to file
*/
blobToFile(inputs: Inputs.Asset.BlobToFileDto): File;
/**
* Converts a File to a Blob.
* @param inputs file to convert
* @returns Blob
* @group convert
* @shortname file to blob
*/
fileToBlob(inputs: Inputs.Asset.FileDto): Blob;
/**
* Converts an ArrayBuffer to a Uint8Array.
* @param inputs ArrayBuffer to convert
* @returns Uint8Array
* @group convert
* @shortname array buffer to uint8 array
*/
arrayBufferToUint8Array(inputs: Inputs.Asset.ArrayBufferToUint8ArrayDto): Uint8Array;
/**
* Converts a Uint8Array to an ArrayBuffer.
* @param inputs Uint8Array to convert
* @returns ArrayBuffer
* @group convert
* @shortname uint8 array to array buffer
*/
uint8ArrayToArrayBuffer(inputs: Inputs.Asset.Uint8ArrayToArrayBufferDto): ArrayBuffer;
}