mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-27 08:10:24 +01:00
fix cleanup
This commit is contained in:
parent
6c358f9b74
commit
d54cf8262a
1 changed files with 4 additions and 1 deletions
|
@ -6,6 +6,8 @@ import FFmpeg from 'fluent-ffmpeg';
|
|||
export async function GenerateVideoThumbnail(source: string): Promise<IImage> {
|
||||
const [dir, cleanup] = await createTempDir();
|
||||
|
||||
const outFile = `${dir}/out.png`;
|
||||
|
||||
try {
|
||||
await new Promise((res, rej) => {
|
||||
FFmpeg({
|
||||
|
@ -22,8 +24,9 @@ export async function GenerateVideoThumbnail(source: string): Promise<IImage> {
|
|||
});
|
||||
|
||||
// JPEGに変換 (Webpでもいいが、MastodonはWebpをサポートせず表示できなくなる)
|
||||
return await convertToJpeg(`${dir}/out.png`, 498, 280);
|
||||
return await convertToJpeg(outFile, 498, 280);
|
||||
} finally {
|
||||
await fs.promises.unlink(outFile);
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue