diff --git a/picture-gallery-server/src/fsExtension.ts b/picture-gallery-server/src/fsExtension.ts index 042c972..69f6fd0 100644 --- a/picture-gallery-server/src/fsExtension.ts +++ b/picture-gallery-server/src/fsExtension.ts @@ -1,34 +1,14 @@ import fs from "fs"; import * as path from "path"; -import sharp from "sharp"; import { Folders } from "./models"; import { publicPath, thumbnailPath } from "./paths"; -import { consoleLogger } from "./logging"; - -const isImageProcessable = async (filePath: string): Promise => - sharp(filePath) - .metadata() - .then(() => true) - .catch((err) => { - consoleLogger.error( - `Reading metadata from ${filePath} produced the following error: ${err.message}`, - ); - return false; - }); export const walk = async (dirPath: string): Promise => { const dirEnts = fs.readdirSync(path.posix.join(publicPath, dirPath), { withFileTypes: true, }); - const numberOfFiles = ( - await Promise.all( - dirEnts - .filter((f) => f.isFile()) - .map((f) => path.posix.join(publicPath, dirPath, f.name)) - .map(isImageProcessable), - ) - ).filter((a) => a).length; + const numberOfFiles = dirEnts.filter((f) => f.isFile()).length; const children = await Promise.all( dirEnts