Documentation ¶
Overview ¶
Package files is for storing files on the cozy, including binary ones like photos and movies. The range of possible operations with this endpoint goes from simple ones, like uploading a file, to more complex ones, like renaming a folder. It also ensure that an instance is not exceeding its quota, and keeps a trash to recover files recently deleted.
Package files is for storing files on the cozy, including binary ones like photos and movies. The range of possible operations with this endpoint goes from simple ones, like uploading a file, to more complex ones, like renaming a folder. It also ensure that an instance is not exceeding its quota, and keeps a trash to recover files recently deleted.
Index ¶
Constants ¶
const ( // FileDocType is document type FileDocType DocType = "io.cozy.files" // FolderDocType is document type FolderDocType = "io.cozy.folders" // ForbiddenFilenameChars is the list of forbidden characters in a filename. ForbiddenFilenameChars = "/\x00" )
const DefaultContentType = "application/octet-stream"
DefaultContentType is used for files uploaded with no content-type
Variables ¶
This section is empty.
Functions ¶
func CreateDirectory ¶
func CreateDirectory(m *DocMetadata, storage afero.Fs) error
CreateDirectory is the method for creating a new directory
@TODO
func CreationHandler ¶
CreationHandler handle all POST requests on /files/:folder-id aiming at creating a new document in the FS. Given the Type parameter of the request, it will either upload a new file or create a new directory.
swagger:route POST /files/:folder-id files uploadFileOrCreateDir
func Upload ¶
func Upload(m *DocMetadata, fs afero.Fs, body io.ReadCloser) (err error)
Upload is the method for uploading a file onto the filesystem.
Types ¶
type DocMetadata ¶
type DocMetadata struct { Type DocType Name string FolderID string Executable bool Tags []string GivenMD5 []byte }
DocMetadata encapsulates the few metadata linked to a document creation request.
func NewDocMetadata ¶
func NewDocMetadata(docTypeStr, name, folderID, tagsStr, md5Str string, executable bool) (m *DocMetadata, err error)
NewDocMetadata is the DocMetadata constructor. All inputs are validated and if wrong, an error is returned.