feat: limit file 50M
This commit is contained in:
@@ -245,13 +245,13 @@ func compressAudio(srcPath, dstPath string) error {
|
|||||||
|
|
||||||
// compress video
|
// compress video
|
||||||
func compressVideo(srcPath, dstPath string) error {
|
func compressVideo(srcPath, dstPath string) error {
|
||||||
// if file size < 100M then copy
|
// if file size < 50M then copy
|
||||||
fileInfo, err := os.Stat(srcPath)
|
fileInfo, err := os.Stat(srcPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "failed to get file info: %s", srcPath)
|
return errors.Wrapf(err, "failed to get file info: %s", srcPath)
|
||||||
}
|
}
|
||||||
if fileInfo.Size() < 100*1024*1024 { // 100 MB
|
if fileInfo.Size() < 50*1024*1024 { // 50 MB
|
||||||
log.Infof("file size < 100M, copy file from %s to %s", srcPath, dstPath)
|
log.Infof("file size < 50M, copy file from %s to %s", srcPath, dstPath)
|
||||||
return copyFile(srcPath, dstPath)
|
return copyFile(srcPath, dstPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user