Skip to content

Commit

Permalink
fix: selected files should not be occupied. closes #150
Browse files Browse the repository at this point in the history
  • Loading branch information
meowtec committed Mar 21, 2023
1 parent 487c7e1 commit abb7b79
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion modules/common/file-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export async function fileMD5(filePath: string) {

export async function imageType(file: string | Buffer) {
if (typeof file === 'string') {
return fileType.fromStream(fs.createReadStream(file))
const stream = fs.createReadStream(file)
const type = await fileType.fromStream(stream)
stream.close()
return type
}
return fileType.fromBuffer(file)
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Imagine",
"private": true,
"version": "0.7.3",
"version": "0.7.4",
"description": "PNG/JPEG optimization app",
"homepage": "https://github.com/meowtec/Imagine",
"repository": {
Expand Down

0 comments on commit abb7b79

Please sign in to comment.