@thankin/thumbnail-generator
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -14,2 +14,2 @@ export declare class FileS { | ||
} | ||
export declare const genThumbnail: (config: ConfigS) => Promise<any>; | ||
export declare const genThumbnail: (config: ConfigS) => Promise<unknown>; |
@@ -226,3 +226,3 @@ "use strict"; | ||
} | ||
const image = sharp_1.default(f.path); | ||
const image = (0, sharp_1.default)(f.path); | ||
//重新设置缩略图文件名 | ||
@@ -238,6 +238,6 @@ image.rotate().resize(300, 200).webp({ quality: 75 }).toFile(newFilePath).then(() => { | ||
else if (await isVideo(f.path) && !ise(config.ffmpegPath)) { | ||
child_process_1.exec(`"${config.ffmpegPath}" -i "${f.path}" -ss 00:00:01.000 -vframes 1 -filter:v scale="300:-1" "${newFilePath}"`); | ||
(0, child_process_1.exec)(`"${config.ffmpegPath}" -i "${f.path}" -ss 00:00:01.000 -vframes 1 -filter:v scale="300:-1" "${newFilePath}"`); | ||
} | ||
else if (await isPDF(f.path) && !ise(config.gswinPath)) { | ||
child_process_1.exec(`"${config.gswinPath}" -sDEVICE=jpeg -o "${newFilePath}" "${f.path}" `); | ||
(0, child_process_1.exec)(`"${config.gswinPath}" -sDEVICE=jpeg -o "${newFilePath}" "${f.path}" `); | ||
} | ||
@@ -244,0 +244,0 @@ } |
{ | ||
"name": "@thankin/thumbnail-generator", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "thumbnail-generator", | ||
@@ -34,4 +34,4 @@ "main": "./dist/index.js", | ||
"@types/sharp": "^0.28.5", | ||
"typescript": "^4.3.5" | ||
"typescript": "^4.4.2" | ||
} | ||
} |
@@ -26,3 +26,3 @@ # ThumbnailGenerator | ||
## | ||
## Features | ||
@@ -29,0 +29,0 @@ - 使用sharp生成图片缩略图 |
14117