chat: github.com/tinode/chat/server/media Index | Files | Directories

package media

import "github.com/tinode/chat/server/media"

Index

Package Files

media.go

func GetIdFromUrl Uses

func GetIdFromUrl(url string, serveUrl string) types.Uid

GetIdFromUrl is a helper method for extracting file ID from a URL.

type Handler Uses

type Handler interface {
    // Init initializes the media upload handler.
    Init(jsconf string) error

    // Check if redirect is required.
    // Redirect can be used to serve files from a different external server.
    Redirect(method, url string) (string, error)

    // Upload processes request for file upload.
    Upload(fdef *types.FileDef, file io.ReadSeeker) (string, error)

    // Download processes request for file download.
    Download(url string) (*types.FileDef, ReadSeekCloser, error)

    // Delete deletes file from storage.
    Delete(locations []string) error

    // GetIdFromUrl extracts file ID from download URL.
    GetIdFromUrl(url string) types.Uid
}

Handler is an interface which must be implemented by media handlers (uploaders-downloaders).

type ReadSeekCloser Uses

type ReadSeekCloser interface {
    io.Reader
    io.Seeker
    io.Closer
}

ReadSeekCloser must be implemented by the media being downloaded.

Directories

PathSynopsis
fsPackage fs implements github.com/tinode/chat/server/media interface by storing media objects in a single directory in the file system.
s3Package s3 implements media interface by storing media objects in Amazon S3 bucket.

Package media imports 4 packages (graph) and is imported by 6 packages. Updated 2019-11-19. Refresh now. Tools for package owners.