kevva / download

Download and extract files
MIT License
1.28k stars 200 forks source link

How can I get the filename if I don't modify it? #172

Open kevinmamaqi opened 6 years ago

kevinmamaqi commented 6 years ago

Is it possible to get the filename of the downloaded file without defining it previously?

zoutepopcorn commented 5 years ago

I think it is not possible at the moment, it will respond with the data only ?

https://github.com/kevva/download/blob/99ac4284cfae629ab9b392a8434c1812b8bbd779/index.js#L106-L118

If you change the line 112, you can have your filename

.then(() => filename);

or something like:

.then(() => { return { uri: uri, filename: filename, data: data } } )

But howto implement this in the right way.

jinphen commented 5 years ago

you can use download2,it will return a object with filename. download2 is modified based on this repo