file

package
v0.0.0-...-dec19c8 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package file provides helpers that are used during video file upload.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSize

func GetSize(filePath string) (uint64, error)

GetSize opens file and returns its size.

Types

type Part

type Part struct {
	Checksum string `json:"checksum"`
	Num      uint   `json:"num"`
	Size     uint   `json:"size"`
}

func MakePartsFromFile

func MakePartsFromFile(filePath string, partSize, size uint64) ([]Part, error)

MakePartsFromFile splits file to parts. It returns slice of parts with fixed size (but last part most probably will have less size) and calculated sha256 checksums.

[]Part actually just represent points in file, and later actual bytes are anyway read from source file using offsets.

Main purpose of []Part is that it goes directly into Video object (which is sent to videoapi).

Jump to

Keyboard shortcuts

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