Get file size prior to start downloading it
See original GitHub issueI’ve started using the library and gone through the simple implementation, although it doesn’t tell about implementation of getting size of file before actually downloading it.
What i tried so far is
String downloadLink = VALID_FILE_URL;
String filePath = Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_DOWNLOADS + File.separator + "file.mp4";
Logger.log(String.valueOf(FileDownloader.getImpl().create(downloadLink).setPath(filePath).getSmallFileTotalBytes()));
but it’s returning 0.00 every time i execute the above code.
Issue Analytics
- State:
- Created 7 years ago
- Comments:19
Top Results From Across the Web
How to know the size of a file before downloading it?
you can get a header called Content-Length form the HTTP Response object that you get, this will give you the length of the...
Read more >How to display file size before starting a download?
To know the file size of a download where the size is not returned by the webserver, you will have to attempt downloading...
Read more >Tip – How to check file size before download from URL
Click on the link to download. Configure SSIS REST API Task to Get file size from URL. Now lets look at how to...
Read more >How to get the file size before downloading ? : r/tasker - Reddit
All I need is to get the file size and store it in variable ... But now how do I check when the...
Read more >Chapter 9 Uploads and downloads - Mastering Shiny
By default, the user can only upload files up to 5 MB. You can increase this limit by setting the shiny.maxRequestSize option prior...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK. I think I know, now. If you want to get TotalBytes through FileDownloader instead of standalone API.
Though I don’t recommend, but you can get totalBytes in
FileDownloadListener#connected
, it is better than inFileDownloadListener#progress
which you did.can’t use
FileDownloader.getImpl().create(downloadLink).setPath(filePath).getSmallFileTotalBytes()
to get so far bytes of a running task.You can get so far bytes of a running task by fellow ways:
FileDownloadListener
which attached to the task object.FileDownloader#getSoFar
through the task Id.