Start of ESM update
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import ft from "file-type";
|
||||
import core from "file-type/core";
|
||||
import { fileTypeFromFile } from "file-type";
|
||||
import { FileTypeResult } from "file-type/core";
|
||||
import fs from "fs-extra";
|
||||
import { access } from "fs/promises";
|
||||
import gm from "gm";
|
||||
import imageThumbnail from "image-thumbnail";
|
||||
import path from "path";
|
||||
import { logger } from "../server";
|
||||
import GenerateUrl from "./MediaUrlGen";
|
||||
import { AssetPaths, FolderPaths } from "./serverInit";
|
||||
const simpleThumb = require("simple-thumbnail");
|
||||
//const ffmpeg = require("ffmpeg-static");
|
||||
@@ -20,7 +19,8 @@ export default async function GenerateThumbnail(
|
||||
file: string
|
||||
//thumbPath: string
|
||||
) {
|
||||
const type: core.FileTypeResult | undefined = await ft.fileTypeFromFile(file);
|
||||
// const type: core.FileTypeResult | undefined = await ft.fileTypeFromFile(file);
|
||||
const type: FileTypeResult | undefined = await fileTypeFromFile(file);
|
||||
let thumbnailExtension: string = GetThumbnailExtension(type);
|
||||
let thumbPath: string = path.join(
|
||||
path.dirname(file),
|
||||
@@ -85,7 +85,7 @@ async function GeneratePdfThumbnail(file: string, thumbPath: string) {
|
||||
});
|
||||
}
|
||||
|
||||
function GetThumbnailExtension(file: core.FileTypeResult | undefined) {
|
||||
function GetThumbnailExtension(file: FileTypeResult | undefined) {
|
||||
if (file === undefined) return ".png";
|
||||
return ".png";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user