chore: Normalize fs-extra usage
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user