Documentation ¶
Overview ¶
Package fs (file system) is an independent component to operate file and directory.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dir ¶
type Dir interface { // Delete the directory. DeleteDirectory() error // Rename the directory. RenameDirectory(newName string) error // Get all lists of files or children's directories in the directory. ReadDirectory() (list.List, error) // Set directory permission. SetDirectoryPermission(permission Mode) error }
Dir operation interface.
type File ¶
type File interface { // Append mode, which adds new data to the end of a file. AppendWriteFile(buffer []byte) error // Vector Append mode, which supports appending consecutive buffers to the end of the file. AppendWritevFile(iov *[][]byte) error // Delete the file. DeleteFile() error // Reading a specified location of file. ReadFile(offset int, buffer []byte) error // Reading contiguous regions of a file and dispersing them into discontinuous buffers. ReadvFile(iov *[][]byte) error // Read the entire file using streaming read StreamReadFile(offset int, buffer []byte) (*Iter, error) // Rename the file. RenameFile(newName string) error // Get the file written data's size and return an error if the file does not exist. The unit of file size is Byte. GetFileSize() (int, error) // Set directory permission. SetFilePermission(permission Mode) error }
File operation interface.
type FileSystem ¶
type FileSystem interface { // Create the directory by specified name and mode. CreateDirectory(name string, permission Mode) error // Open the directory by specified name. OpenDirectory(name string) (*Dir, error) // Create the file by specified name and mode. CreateFile(name string, permission Mode) error // Open the file by specified name. OpenFile(name string) (*File, error) // Flush mode, which flushes all data to one file. FlushWriteFile(buffer []byte, permission Mode) (*File, error) }
FileSystem operation interface.
Click to show internal directories.
Click to hide internal directories.