⌨️ Added a type for image stats

This commit is contained in:
2021-08-03 22:11:58 -07:00
parent 51d8f94068
commit 29851c5736
3 changed files with 21 additions and 77 deletions

View File

@@ -31,7 +31,7 @@ SOFTWARE.
* Initial: 2021/05/04 Rishi Ghan
*/
import { createReadStream, createWriteStream, readFileSync } from "fs";
import { createReadStream, createWriteStream, readFileSync, stat } from "fs";
const fse = require("fs-extra");
import path from "path";
import { each, isEmpty, map, flatten } from "lodash";
@@ -42,6 +42,7 @@ import {
IExtractedComicBookCoverFile,
IExtractionOptions,
IFolderData,
ISharpResizedImageStats,
} from "threetwo-ui-typings";
import { logger } from "./logger.utils";
import { validateComicBookMetadata } from "../utils/validation.utils";
@@ -95,12 +96,12 @@ export const extractCoverFromFile = async (
);
// create renditions
const renditionPath = constructedPaths.targetPath + "/" + walkedFolder.name + "_200px.jpg";
await resizeImage(targetCoverImageFilePath, path.resolve(renditionPath), 200);
const stats:ISharpResizedImageStats = await resizeImage(targetCoverImageFilePath, path.resolve(renditionPath), 200);
resolve({
name: walkedFolder.name,
path: constructedPaths.targetPath + "/" + walkedFolder.name + "_200px.jpg", //renditionPath
fileSize: 0,
fileSize: stats.size,
containedIn: walkedFolder.containedIn,
//originalPath:
//extension: