ibrod83 / nodejs-file-downloader

129 stars 23 forks source link

The downloaded file has no extension,such as bing wallpaper. #58

Closed Epxir closed 1 year ago

ibrod83 commented 1 year ago

It probably doesn't recognize it automatically via the url/headers. Do you have an address of such a file, that you can provide?

Epxir commented 1 year ago

https://www.bing.com//th?id=OHR.ThreeElephants_EN-US3930300492_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp

ibrod83 commented 1 year ago

It happens because of the structure of the URL, and the way it's handled by my code. It will take time until i refactor and resolve the issue. As a workaround, i would set a custom filename, perhaps with a random string, and a jpeg extension. You can also try using one of the hooks, like onBeforeSave(will allow you to overwrite the automatically set filename)

Epxir commented 1 year ago

Redirected images result in caught TypeError:assert is not a function and the request timed out,https://www.dmoe.cc/random.php

ibrod83 commented 1 year ago

What redirected images? I tried this url that you provided, and i get a large image downloaded successfully