upload

package module
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README

Go uploader package

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Dir = "upload"

Functions

func InitDir added in v1.1.8

func InitDir()

Types

type Chunk

type Chunk struct {
	ID        string
	Hash      string
	CreatedAt time.Time
}

type CreateUploadResponse

type CreateUploadResponse struct {
	UploadId string
}

type DownloadRequest

type DownloadRequest struct {
	UploadId string
}

type File

type File struct {
	UploadId string
	Filename string
	Size     uint64
}

type FileChunk

type FileChunk struct {
	Hash        string
	ChunkNumber int
}

type FileController

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

func (*FileController) Download

func (c *FileController) Download(ctx *gin.Context)

func (*FileController) NewUpload

func (c *FileController) NewUpload(ctx *gin.Context)

func (*FileController) Reassemble

func (c *FileController) Reassemble(ctx *gin.Context)

func (*FileController) UploadChunk

func (c *FileController) UploadChunk(ctx *gin.Context)

type ReassembleChunksRequest

type ReassembleChunksRequest struct {
	UploadId string
	Chunks   []FileChunk
	Filename string
}

type ReassembleChunksResponse

type ReassembleChunksResponse struct {
	Hash     string
	Filename string
}

type Service added in v1.1.8

type Service struct {
}

func (Service) CreateUpload added in v1.1.8

func (u Service) CreateUpload() CreateUploadResponse

func (Service) Download added in v1.1.8

func (u Service) Download(req DownloadRequest, header http.Header, writer io.Writer) error

func (Service) ReassembleChunk added in v1.1.8

ReassembleChunk put chunks together

func (Service) UploadChunk added in v1.1.8

func (u Service) UploadChunk(req *http.Request) (*UploadChunkResponse, error)

UploadChunk upload each 4MB chunk of a file

type UploadChunkResponse

type UploadChunkResponse struct {
	ID   string
	Hash string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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