Documentation
¶
Overview ¶
Package filen provides an SDK interface to interact with the cloud drive.
Index ¶
- type Directory
- type File
- type Filen
- func (filen *Filen) CurrentMasterKey() []byte
- func (filen *Filen) DownloadFile(file *File, chunkHandler func(chunk int, data []byte) error) error
- func (filen *Filen) DownloadFileInMemory(file *File) ([]byte, error)
- func (filen *Filen) DownloadFileToDisk(file *File, destination *os.File) error
- func (filen *Filen) GetBaseFolderUUID() (string, error)
- func (filen *Filen) PathToUUID(path string, requireDirectory bool) (string, error)
- func (filen *Filen) ReadDirectory(uuid string) ([]*File, []*Directory, error)
- func (filen *Filen) UploadFile(source *os.File, parentUUID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Directory ¶
type Directory struct { UUID string // the UUID of the cloud item Name string // the directory name ParentUUID string // the [Directory.UUID] of the directory's parent directory (or zero value for the root directory) Color string // the color assigned to the directory (zero value means default color) Created time.Time // when the directory was created Favorited bool // whether the directory is marked a favorite }
Directory represents a directory on the cloud drive.
type File ¶
type File struct { UUID string // the UUID of the cloud item Name string // the file name Size int64 // the file size in bytes MimeType string // the MIME type of the file EncryptionKey []byte // the key used to encrypt the file data Created time.Time // when the file was created LastModified time.Time // when the file was last modified ParentUUID string // the [Directory.UUID] of the file's parent directory Favorited bool // whether the file is marked a favorite Region string // the file's storage region Bucket string // the file's storage bucket Chunks int // how many 1 MiB chunks the file is partitioned into }
File represents a file on the cloud drive.
type Filen ¶
type Filen struct { // MasterKeys contains the crypto master keys for the current user. When the user changes // their password, a new master key is appended. For decryption, all master keys are tried // until one works; for decryption, always use the latest master key. MasterKeys [][]byte // contains filtered or unexported fields }
Filen provides the SDK interface. Needs to be initialized via New.
func New ¶
New creates a new Filen and initializes it with the given email and password by logging in with the API and preparing the API key and master keys.
func (*Filen) CurrentMasterKey ¶
CurrentMasterKey returns the current master key to use for encryption. Multiple possible master keys exist for decryption, but only the latest one should be used for encryption.
func (*Filen) DownloadFile ¶
DownloadFile downloads a file from the cloud drive and calls the chunkHandler for every received chunk.
func (*Filen) DownloadFileInMemory ¶
DownloadFileInMemory downloads a file from the cloud drive and stores its bytes in memory.
func (*Filen) DownloadFileToDisk ¶
DownloadFileToDisk downloads a file from the cloud drive into a local destination on disk.
func (*Filen) GetBaseFolderUUID ¶
GetBaseFolderUUID fetches the UUID of the cloud drive's root directory.
func (*Filen) PathToUUID ¶
PathToUUID identifies a cloud item by its path and returns its UUID. Set the requireDirectory to differentiate between files and directories with the same path (otherwise, the file will be found).
func (*Filen) ReadDirectory ¶
ReadDirectory fetches the files and directories that are children of a directory (specified by UUID).
Directories
¶
Path | Synopsis |
---|---|
Package client handles HTTP requests to the API and storage backends.
|
Package client handles HTTP requests to the API and storage backends. |
Package crypto provides the cryptographic functions required within the SDK.
|
Package crypto provides the cryptographic functions required within the SDK. |