Skip to content

Commit

Permalink
29 getting extraneous console output no file extension found attempti…
Browse files Browse the repository at this point in the history
…ng mime typing (#45)

* add index file and change some imports

* updated the file type and pngjs versions

* fixes for logs

* version bump

* added verbose logging option
  • Loading branch information
danm authored May 3, 2022
1 parent cbcb2a8 commit 225af27
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ imageHash(location, bits, precise, callback);
imageHash(string|object, int, bool, function);
```
## SETTINGS
Image hash will log out warnings if environment variable `VERBOSE` is set to true.
### Image-Hash Arguments
| Argument | Type | Description | Mandatory | Example |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "image-hash",
"version": "5.2.0",
"version": "5.3.0",
"description": "Create a hash from an image",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const imageHash = (oldSrc: string | UrlRequestObject | BufferObject, bits
cb(new Error(`Unrecognized file extension, mime type or mismatch, ext: ${ext} / mime: ${type.mime}`));
}
} else {
console.warn('No file extension found, attempting mime typing.');
if (process.env.verbose) console.warn('No file extension found, attempting mime typing.');
if (type.mime === 'image/png') {
processPNG(data, bits, method, cb);
} else if (type.mime === 'image/jpeg') {
Expand Down

0 comments on commit 225af27

Please sign in to comment.