# snap_getFile

> Reference documentation for the `snap_getFile` method of the Snaps API.

<SnapsAPIReference method={{"name":"snap_getFile","description":"Gets a static file's content in UTF-8, Base64, or hexadecimal.\n\nThe file must be specified in [the Snap's manifest file](https://docs.metamask.io/snaps/features/static-files/).","parameters":{"kind":"object","type":"{ path: string; encoding?: \"base64\" | \"hex\" | \"utf8\" | null }","description":"An object containing the parameters for the `snap_getFile` method.","required":true,"properties":[{"kind":"primitive","type":"string","description":"The path to the file, relative to the Snap's package directory\n(that is, one level above `src`).","name":"path","required":true},{"kind":"primitive","type":"\"base64\" | \"hex\" | \"utf8\"","description":"The encoding to use when retrieving the file. Defaults to `base64`.","name":"encoding","required":false}]},"result":{"kind":"primitive","type":"string | null","description":"The file content as a string in the requested encoding, or `null` if the\nfile does not exist."},"subjectTypes":["snap"],"examples":[{"examples":[{"name":"Manifest","language":"json","content":"{\n  \"source\": {\n    \"files\": [\"./files/my-file.bin\"]\n  }\n}\n"},{"name":"Usage","language":"ts","content":"const contents = await snap.request({\n  method: 'snap_getFile',\n  params: {\n    path: './files/myfile.bin',\n    encoding: 'hex',\n  },\n})\n\n// '0x...'\nconsole.log(contents)\n"}]}],"restricted":false}}  />
