Skip to content

Commit

Permalink
feat: only compress if result size is < orignial
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwynr committed Jun 15, 2023
1 parent c4ee4c6 commit 36e7c5f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/lib/services/cameraUpload/cameraUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,7 @@ export const compressImage = async (inputPath: string) => {
await fs.unlink(inputPath)
}

const statsAfter = await fs.stat(compressed.path)

if (statsAfter.exists && statsAfter.size >= statsBefore.size) {
if (compressed.size >= statsBefore.size) {
await fs.unlink(compressed.path)

return inputPath
Expand Down

0 comments on commit 36e7c5f

Please sign in to comment.