tus

package
v0.0.0-...-ae9f4d3 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 12 Imported by: 0

README

tus

import "github.com/cognusion/go-jar/tus"

Overview

Index

Package files

config.go tus.go

Constants

const (
    // ErrBadTargetPrefix is returned by HandleFinisher if the requested TUS targetURL prefix does not exist
    ErrBadTargetPrefix = Error("requested targetURI prefix is not valid")
)

Variables

var (
    // DebugOut is a log.Logger for debug messages
    DebugOut = log.New(io.Discard, "[DEBUG] ", 0)
    // ErrorOut is a log.Logger for error messages
    ErrorOut = log.New(io.Discard, "[ERROR] ", 0)
)

type Config

type Config struct {
    // TargetURI is a `file://` or `s3://` URI to designate where the upload should go
    TargetURI string
    // AppendFilename renames (COPY,DELETE) the file after upload to append `-filename.ext`. This can result in
    // increased costs for paid storage services
    AppendFilename bool
    // S3Client is an s3.S3 to be used if TargetURI is an `s3://`
    S3Client *s3.S3
}

Config encapsulates various options passable to New

type Error

type Error string

Error is an error type

func (Error) Error
func (e Error) Error() string

Error returns the stringified version of Error

type TUS

type TUS struct {
    // contains filtered or unexported fields
}

TUS is a Finisher implementing the tus.io Open Protocol for Resumable Uploads

func New
func New(basePath string, config Config) (*TUS, error)

New returns an initialized TUS. WARNING: Do not set Config.S3Client unless you're using S3 as the target.

func (*TUS) ServeHTTP
func (t *TUS) ServeHTTP(w http.ResponseWriter, r *http.Request)

Generated by godoc2md

Documentation

Index

Constants

View Source
const (
	// ErrBadTargetPrefix is returned by HandleFinisher if the requested TUS targetURL prefix does not exist
	ErrBadTargetPrefix = Error("requested targetURI prefix is not valid")
)

Variables

View Source
var (
	// DebugOut is a log.Logger for debug messages
	DebugOut = log.New(io.Discard, "[DEBUG] ", 0)
	// ErrorOut is a log.Logger for error messages
	ErrorOut = log.New(io.Discard, "[ERROR] ", 0)
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// TargetURI is a `file://` or `s3://` URI to designate where the upload should go
	TargetURI string
	// AppendFilename renames (COPY,DELETE) the file after upload to append `-filename.ext`. This can result in
	// increased costs for paid storage services
	AppendFilename bool
	// S3Client is an s3.S3 to be used if TargetURI is an `s3://`
	S3Client *s3.S3
}

Config encapsulates various options passable to New

type Error

type Error string

Error is an error type

func (Error) Error

func (e Error) Error() string

Error returns the stringified version of Error

type TUS

type TUS struct {
	// contains filtered or unexported fields
}

TUS is a Finisher implementing the tus.io Open Protocol for Resumable Uploads

func New

func New(basePath string, config Config) (*TUS, error)

New returns an initialized TUS. **WARNING:** Do not set `Config.S3Client` unless you're using S3 as the target.

func (*TUS) ServeHTTP

func (t *TUS) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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