Skip to content

Commit

Permalink
fix: use fse.copyFile instead of fse.copy because that copy wil…
Browse files Browse the repository at this point in the history
…l also copy file mode and other things which would cause something wrong.

close #90 #91
  • Loading branch information
meowtec committed May 8, 2021
1 parent 9a535d7 commit 9c741d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions modules/backend/save.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export async function saveFiles(images: IImageFile[], type: SaveType, dirname?:
break
}

await fs.copy(fu.getFilePath(image), savePath).catch(noop)
await fs.copyFile(fu.getFilePath(image), savePath).catch(noop)
}
}

export async function saveFile(image: IImageFile, filePath: string) {
await fs.copy(fu.getFilePath(image), filePath)
await fs.copyFile(fu.getFilePath(image), filePath)
}
2 changes: 1 addition & 1 deletion modules/common/file-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const saveFilesTmp = (files: string[]) => Promise.all(files.map(async (fi
const dest = getFilePath(descriptor)
descriptor.url = getFileUrl(dest)

await fs.copy(file, dest)
await fs.copyFile(file, dest)

return descriptor as IImageFile
}))
Expand Down

0 comments on commit 9c741d6

Please sign in to comment.