From f4af6a1ce7649db2ebc7e5c56f47e8ed61b2ace9 Mon Sep 17 00:00:00 2001 From: Arafat Rahaman <96245505+Hieser21@users.noreply.github.com> Date: Mon, 24 Apr 2023 08:50:36 +0600 Subject: [PATCH] Update local-provider.ts This is a patch because of the error mentioned in code. sometimes /tmp is in a different partition. This is a replication of fs.promises.rename that works the same way. Hope this helps! --- src/features/upload-file/providers/local-provider.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/features/upload-file/providers/local-provider.ts b/src/features/upload-file/providers/local-provider.ts index 625cd54..e6319f3 100644 --- a/src/features/upload-file/providers/local-provider.ts +++ b/src/features/upload-file/providers/local-provider.ts @@ -33,7 +33,8 @@ export class LocalProvider extends BaseProvider { const filePath = process.platform === 'win32' ? this.path(key) : this.path(key).slice(1) // adjusting file path according to OS await fs.promises.mkdir(path.dirname(filePath), { recursive: true }) - await fs.promises.rename(file.path, filePath) + await fs.promises.copyFile(file.path, filePath) //Changed for Error: EXDEV: cross-device link not permitted + await fs.promises.unlink(file.path) } public async delete(key: string, bucket: string): Promise {