Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChunkBLOBInfo ¶
ChunkBLOBInfo stores info about a particular chunk
func GetChunkBLOBInfo ¶
func GetChunkBLOBInfo(path string) (*ChunkBLOBInfo, error)
GetChunkBLOBInfo decodes a chunk name to retrieve info about it.
type ChunkHandler ¶
type ChunkHandler struct {
ChunkFolder string `mapstructure:"chunk_folder"`
}
ChunkHandler manages chunked uploads, storing the chunks in a temporary directory until it gets the final chunk which is then returned.
func NewChunkHandler ¶
func NewChunkHandler(chunkFolder string) *ChunkHandler
NewChunkHandler creates a handler for chunked uploads.
func (*ChunkHandler) Assemble ¶
func (c *ChunkHandler) Assemble(chunkName string, body io.ReadCloser) (io.ReadCloser, int64, bool, error)
Assemble saves an intermediate chunk and, once all chunks have arrived, assembles them into a single temp file. Returns (reader, size, true, nil) when the transfer is complete. Returns (nil, 0, false, nil) when more chunks are still expected (partial transfer) the returned reader removes the temp file on Close
func (*ChunkHandler) WriteChunk ¶
func (c *ChunkHandler) WriteChunk(fn string, r io.ReadCloser) (string, string, error)
WriteChunk saves an intermediate chunk temporarily and assembles all chunks once the final one is received.