Comparing version 1.5.1 to 1.5.2
@@ -118,3 +118,3 @@ "use strict"; | ||
else { | ||
savedVideoPath = item.url; | ||
savedVideoPath = await (0, file_1.copyLocalFile)(item.url, cacheDir); | ||
} | ||
@@ -121,0 +121,0 @@ progress(40 + Math.floor((index * 45) / validVideoItems.length)); |
import { Stream } from 'stream'; | ||
declare const isFilePath: (url: string) => boolean; | ||
declare const writeFileWithStream: (stream: Stream, videoPath: string) => Promise<unknown>; | ||
export { writeFileWithStream, isFilePath }; | ||
declare const copyLocalFile: (targetPath: string, cacheDir: string) => Promise<string | null>; | ||
export { writeFileWithStream, copyLocalFile, isFilePath }; |
@@ -6,5 +6,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isFilePath = exports.writeFileWithStream = void 0; | ||
exports.isFilePath = exports.copyLocalFile = exports.writeFileWithStream = void 0; | ||
const path_1 = __importDefault(require("path")); | ||
const fs_extra_1 = __importDefault(require("fs-extra")); | ||
const md5_1 = __importDefault(require("md5")); | ||
const log_1 = require("../utils/log"); | ||
@@ -29,2 +30,15 @@ const isFilePath = (url) => { | ||
exports.writeFileWithStream = writeFileWithStream; | ||
const copyLocalFile = async (targetPath, cacheDir) => { | ||
try { | ||
await fs_extra_1.default.ensureDir(cacheDir); | ||
const videoId = `vid-${(0, md5_1.default)(Math.random().toString())}`; | ||
const videoPath = path_1.default.join(cacheDir, `${videoId}.mp4`); | ||
await fs_extra_1.default.copy(targetPath, videoPath); | ||
return videoPath; | ||
} | ||
catch (err) { | ||
return null; | ||
} | ||
}; | ||
exports.copyLocalFile = copyLocalFile; | ||
//# sourceMappingURL=file.js.map |
{ | ||
"name": "ffaivideo", | ||
"version": "1.5.1", | ||
"version": "1.5.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
200351
2453