Files and directories
This guide will walk you through downloading and uploading files, as well as listing and managing files and directories.
Everything described here is implemented in our TypeScript SDK, so you can always look at the SDK source if you need more information.
General information
UUIDs
Since all Filen user data is encrypted on the client-side, including directory names, every file and directory is identified by its UUID. Therefore, to access any file or directory by its path, you need to start from the root directory and traverse the path hierarchy from there.
File and directory metadata
The metadata of files (including name, MIME type, size, timestamp and encryption key) and directories (its name) is always client-side encrypted using the master key, as described in the Cryptography guide.
File chunks
The binary data of files is saved in chunks of 1MiB. The chunk's data is encrypted as described in the Cryptography guide. A randomly generated encryption key is used for each file.
Navigating the file tree
User root directory
To get the user's root (/) directory's UUID, simply call /v3/user/baseFolder.
Listing a directory
Once you have a directory's UUID, you can list the files and directories inside it using /v3/dir/content. Note that the contained files are named uploads, the directories folders. You'll also need to decrypt item metadata (including an item's name). All this is decribed in full detail in the endpoint documentation.
If you want to get a directory's UUID from its path, you need to start at the root directory and traverse the entire path, repeatedly getting the UUID for the next path segment from a directory's list of subdirectories.