Skip to main content
  • Snap

snap_getFile

Description

Gets a static file's content in UTF-8, Base64, or hexadecimal.

The file must be specified in the Snap's manifest file.

Parameters

path

stringrequired

The path to the file, relative to the Snap's package directory (that is, one level above src).

encoding

"base64" | "hex" | "utf8" | null

The encoding to use when retrieving the file. Defaults to base64.

Returns

string

The file content as a string in the requested encoding.

Example

{
"source": {
"files": ["./files/my-file.bin"]
}
}