chore: Normalize fs-extra usage

This commit is contained in:
Tom Moor
2023-11-15 19:43:17 -05:00
parent 726613bf1d
commit cf6a946c9c
5 changed files with 19 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
import fs from "fs";
import fs from "fs-extra";
import truncate from "lodash/truncate";
import { FileOperationState, NotificationEventType } from "@shared/types";
import { bytesToHumanReadable } from "@shared/utils/files";
@@ -89,7 +89,7 @@ export default abstract class ExportTask extends BaseTask<Props> {
state: FileOperationState.Uploading,
});
const stat = await fs.promises.stat(filePath);
const stat = await fs.stat(filePath);
const url = await FileStorage.store({
body: fs.createReadStream(filePath),
contentLength: stat.size,
@@ -129,7 +129,7 @@ export default abstract class ExportTask extends BaseTask<Props> {
throw error;
} finally {
if (filePath) {
void fs.promises.unlink(filePath).catch((error) => {
void fs.unlink(filePath).catch((error) => {
Logger.error(`Failed to delete temporary file ${filePath}`, error);
});
}