file

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2022 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const HLS_HEADER_FILENAME = "index.m3u8"
View Source
const HLS_SEGMENT_FILENAME = "%d.ts"
View Source
const TEMP_FOLDER = "tmp"

Variables

View Source
var HlsInfoMap = make(map[string]*HlsInfo)

Functions

func CheckFileExisting

func CheckFileExisting(fileHash, fileName, savePath, encryptionTag string) bool

CheckFileExisting

func CheckFilePathEx

func CheckFilePathEx(fileHash, fileName, savePath string) bool

CheckFilePathEx

func CheckSliceExisting

func CheckSliceExisting(fileHash, fileName, sliceHash, savePath string) bool

CheckSliceExisting

func ClearFileMap

func ClearFileMap(hash string)

ClearFileMap

func DeleteDirectory

func DeleteDirectory(fileHash string)

DeleteDirectory DeleteDirectory

func DeleteSlice

func DeleteSlice(sliceHash string) error

DeleteSlice

func EscapePath

func EscapePath(param []string) string

EscapePath

func GetAllFiles

func GetAllFiles(pathname string)

GetAllFiles get all files in directory and all sub-directory recursively

func GetDownloadCsvPath

func GetDownloadCsvPath(fileHash, fileName, savePath string) string

GetDownloadCsvPath get download CSV path

func GetDownloadPath

func GetDownloadPath(fileName string) string

GetDownloadPath get download path

func GetDownloadTmpPath

func GetDownloadTmpPath(fileHash, fileName, savePath string) string

GetDownloadTmpPath get temporary download path

func GetDumpySliceData

func GetDumpySliceData(fileHash string, sliceNumber uint64) []byte

func GetFileData

func GetFileData(filePath string, offset *protos.SliceOffset) []byte

GetFileData

func GetFileHash

func GetFileHash(filePath, encryptionTag string) string

GetFileHash

func GetFileInfo

func GetFileInfo(filePath string) os.FileInfo

GetFileInfo

func GetFilePath

func GetFilePath(hash string) string

GetFilePath

func GetFileSuffix

func GetFileSuffix(fileName string) string

GetFileSuffix

func GetSliceData

func GetSliceData(sliceHash string) []byte

GetSliceData

func GetSliceSize

func GetSliceSize(sliceHash string) int64

GetSliceSize

func GetVideoDuration

func GetVideoDuration(path string) (uint64, error)

func GetVideoTmpFolder

func GetVideoTmpFolder(fileHash string) string

func GetWholeFileData

func GetWholeFileData(filePath string) []byte

func IsFile

func IsFile(f string) (bool, error)

IsFile checks if the path is a file or directory

func PathExists

func PathExists(path string) (bool, error)

pathExists

func RecordDownloadCSV

func RecordDownloadCSV(target *protos.RspFileStorageInfo)

RecordDownloadCSV

func SaveDownloadProgress

func SaveDownloadProgress(sliceHash, fileName, fileHash, savePath string)

SaveDownloadProgress

func SaveFileData

func SaveFileData(data []byte, offset int64, sliceHash, fileName, fileHash, savePath string) bool

SaveFileData

func SaveSliceData

func SaveSliceData(data []byte, sliceHash string, offset uint64) bool

SaveSliceData

func VideoToHls

func VideoToHls(fileHash string) bool

Types

type HlsInfo

type HlsInfo struct {
	FileHash         string
	HeaderFile       string
	StartSliceNumber uint64
	TotalSize        int64
	SegmentToSlice   map[string]uint64
	SliceToSegment   map[uint64]string
}

func GetHlsInfo

func GetHlsInfo(fileHash string, maxSliceCount uint64) (*HlsInfo, error)

func LoadHlsInfo

func LoadHlsInfo(fileHash, sliceHash, savePath string) *HlsInfo

Jump to

Keyboard shortcuts

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