files

package
v0.0.0-...-700955b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2016 License: AGPL-3.0 Imports: 12 Imported by: 0

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

View Source
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"
)
View Source
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

func CreationHandler(c *gin.Context)

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 Routes

func Routes(router *gin.RouterGroup)

Routes sets the routing for the files service

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.

type DocType

type DocType string

DocType is the type of document, eg. file or folder

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL