Skip to content

EnsureReleaseAssetParams

Parameters for ensureReleaseAsset.

Import:

import type { EnsureReleaseAssetParams } from '@mnaoumov/obsidian-lib/release-asset';

Signature:

export interface EnsureReleaseAssetParams

Properties

PropertyTypeDescription
abortSignal?AbortSignal | undefinedAborts the operation. Pass the plugin's abort signal, so an unload stops it.
appAppThe Obsidian application instance.
cacheFolderPathstringThe vault-relative folder that holds the cached file, typically ${plugin.manifest.dir}/assets.

A folder inside the config folder is not synced, so each device downloads the asset once.
fileNamestringThe name of the cached file. It must not contain a path separator.
sha256stringThe expected SHA-256 of the asset, as 64 hexadecimal digits.
shouldDownload?((request: ReleaseAssetConsentRequest) => Promise<boolean>) | undefinedAsks the user whether to download the asset. Defaults to a confirmation modal.

Pass () => Promise.resolve(true) when the user has already agreed, for example through a setting.
sizeInBytes?number | undefinedThe size of the asset in bytes, shown to the user when asking.
timeoutInMilliseconds?number | undefinedThe download timeout in milliseconds.
urlstringThe URL to download the asset from. Only http: and https: URLs are accepted.

Links to this page: