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

object

The request parameters for the snap_getFile method.

path

string
required

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

encoding

"base64" | "hex" | "utf8"

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"]
}
}