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";
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import fs from "fs-extra";
|
||||
|
||||
import dotenv from "dotenv";
|
||||
import ft from "file-type";
|
||||
import core from "file-type/core";
|
||||
import { fileTypeFromFile } from "file-type";
|
||||
import { FileTypeResult } from "file-type/core";
|
||||
import gm from "gm";
|
||||
import path, { resolve } from "path";
|
||||
import { logger } from "../server";
|
||||
@@ -18,7 +18,7 @@ dotenv.config({
|
||||
|
||||
export async function ConvertHeicFiles(files: Express.Multer.File[]) {
|
||||
for (const file of files) {
|
||||
const type: core.FileTypeResult | undefined = await ft.fileTypeFromFile(file.path);
|
||||
const type: FileTypeResult | undefined = await fileTypeFromFile(file.path);
|
||||
if (type?.mime === "image/heic") {
|
||||
logger.log("debug", `Converting ${file.filename} image to JPEG from HEIC.`);
|
||||
const convertedFileName = `${
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import fs = require("fs-extra");
|
||||
import dotenv from "dotenv";
|
||||
import { ensureDirSync } from "fs-extra";
|
||||
import os from "os";
|
||||
import path, { resolve } from "path";
|
||||
import { logger } from "../server";
|
||||
@@ -36,11 +36,11 @@ export function BillsRelativeFilePath(jobid: string, filename: string) {
|
||||
}
|
||||
export default function InitServer() {
|
||||
logger.info(`Ensuring Root media path exists: ${FolderPaths.Root}`);
|
||||
fs.ensureDirSync(FolderPaths.Root);
|
||||
ensureDirSync(FolderPaths.Root);
|
||||
logger.info(`Ensuring Jobs media path exists: ${FolderPaths.Jobs}`);
|
||||
fs.ensureDirSync(FolderPaths.Jobs);
|
||||
ensureDirSync(FolderPaths.Jobs);
|
||||
logger.info(`Ensuring Vendors media path exists: ${FolderPaths.Vendors}`);
|
||||
fs.ensureDirSync(FolderPaths.Vendors);
|
||||
ensureDirSync(FolderPaths.Vendors);
|
||||
logger.info("Folder Paths", FolderPaths);
|
||||
logger.info("IMS Token set to: " + (process.env.IMS_TOKEN || "").trim());
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Request, Response, NextFunction } from "express";
|
||||
import dotenv from "dotenv";
|
||||
import { NextFunction, Request, Response } from "express";
|
||||
import { resolve } from "path";
|
||||
import { logger } from "../server";
|
||||
//import { logger } from "../server.ts";
|
||||
|
||||
dotenv.config({
|
||||
path: resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}`)
|
||||
|
||||
Reference in New Issue
Block a user