zouhir / lqip

Low Quality Image Placeholders (LQIP) Module for Node
433 stars 30 forks source link

File extension is used to validate file support and to get mime type #17

Open cullylarson opened 4 years ago

cullylarson commented 4 years ago

In index.js, the file extension is used to determine whether the file is supported by lqip. It is later used to get the mime type of the file.

The problem is that you can't use lqip to process files without extensions. I'm running into this issue dealing with uploaded files processed by formidable. Yes, I could rename the file first, but if the file is on a network share it may be necessary to copy and unlink in order to rename a file.

A couple potential solutions are (1) get the mime type from the file itself, or (2) allow passing the mime type as a parameter to lqip.base64.