Set Asset File

asset.setFile(fileBlob)

Set the file of an asset. Use this method to replace the file of an existing asset with a new file.

Syntax

1asset.setFile(fileBlob: File): Promise<null>

Parameters

  • fileBlob: File - The file to set the asset to.

Returns

A Promise that resolves to null.

Example

1const assets = await webflow.getAllAssets();
2const asset = assets[0];
3const newFile = new File([blob], 'marvin-smiling.png', { type: 'image/png' });
4await asset.setFile(newFile);

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canManageAssetsAnyAnyAnyAny
Built with