It's possible to get file type from url by using regex/lastIndexOf, but it is only possible if url contain a file (like .html, .pdf or .doc).
But in case of links like, https://www.gutenberg.org/ebooks/54323.epub.images, there is no valid file name. I can still get content-type from XMLHttpRequest or https.get, but the result is incorrect.
Another link is http://mymp3song.info/files/download/type/128/id/64203
I tried file-type node module which gives the file type by reading buffer array. But it isn't working either (giving null value).
Is there a way i can accomplish this in node?
via Amit Kumar
No comments:
Post a Comment