Do not recreate thumbnails on every startup
This commit is contained in:
parent
1034df02f2
commit
c5a7999c1a
|
|
@ -38,9 +38,12 @@ export const initThumbnailsAsync = (dirPath: string) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const dirEnts = fs.readdirSync(publicPath + dirPath, { withFileTypes: true });
|
const dirEnts = fs.readdirSync(publicPath + dirPath, { withFileTypes: true });
|
||||||
|
fs.mkdirSync(thumbnailPublicPath + dirPath, { recursive: true });
|
||||||
|
const thumbnails = fs.readdirSync(thumbnailPublicPath + dirPath);
|
||||||
|
|
||||||
dirEnts
|
dirEnts
|
||||||
.filter((f) => f.isFile())
|
.filter((f) => f.isFile())
|
||||||
|
.filter((f) => !thumbnails.includes(f.name))
|
||||||
.map((f) => createThumbnailAsyncForImage(`${dirPath}/${f.name}`));
|
.map((f) => createThumbnailAsyncForImage(`${dirPath}/${f.name}`));
|
||||||
dirEnts
|
dirEnts
|
||||||
.filter((f) => f.isDirectory())
|
.filter((f) => f.isDirectory())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue