Assets

Assets

Metafold assets endpoint.

Constructor

new Assets()

Source:

Classes

Assets

Methods

(async) create(data, filenameopt)

Upload an asset.
Source:
Parameters:
Name Type Attributes Description
data any Asset data to upload, typically a File or Blob.
filename string <optional>
Name of the file.
Returns:
Asset resource.

(async) delete(id)

Delete an asset.
Source:
Parameters:
Name Type Description
id string ID of asset to delete.

(async) download(id, responseTypeopt)

Download an asset.
Source:
Parameters:
Name Type Attributes Default Description
id string ID of asset to download.
responseType string <optional>
"stream" Type of response data. Options include: "arraybuffer", "document", "json", "text", or "stream". See Axios docs for details.
Returns:
Response object with asset data.

(async) downloadURL(id, paramsopt) → {string}

Retrieve public asset download URL.
Source:
Parameters:
Name Type Attributes Description
id string ID of asset to download.
params Object <optional>
Optional download parameters.
Name Type Attributes Description
filename string <optional>
Filename of downloaded file.
Returns:
Type:
string
Asset download URL. Note the URL is only valid from one hour of generation.

(async) get(id)

Get an asset.
Source:
Parameters:
Name Type Description
id string ID of asset to get.
Returns:
Asset resource.

(async) list(paramsopt)

List assets.
Source:
Parameters:
Name Type Attributes Description
params Object <optional>
Optional list parameters.
Name Type Attributes Description
sort string <optional>
Sort string. For details on syntax see the Metafold API docs. Supported sorting fields are: "id", "filename", "size", "created", or "modified".
q string <optional>
Query string. For details on syntax see the Metafold API docs. Supported search fields are: "id" and "filename".
Returns:
List of asset resources.

(async) update(id, data, filenameopt)

Update an asset.
Source:
Parameters:
Name Type Attributes Description
id string ID of asset to update.
data any Asset data to upload, typically a File or Blob.
filename string <optional>
Name of the file.
Returns:
Asset resource.