Logo

dev-resources.site

for different kinds of informations.

Downloading the same file 102+ times

Published at
1/8/2025
Categories
todayilearned
browser
Author
dzhavat
Categories
2 categories in total
todayilearned
open
browser
open
Author
7 person written this
dzhavat
open
Downloading the same file 102+ times

Have YOU ever tried downloading the same file 102+ times in your favorite browser? Do you know what happens on the 102nd time? šŸ™ƒ

I do. The answer is ... it depends šŸ˜‹ It varies between browsers and itā€™s a bit of a surprise.

Before I show you the screenshots, let me first tell you a short story about how I ended up in the ā€œlets-download-this-file-102-timesā€ rabbit hole so bear with me.

I work as a software developer and one day I got a message from a colleague asking something about a new feature. She sent me a link to an issue. There was a screenshot that caught my attention. It looked very much like the one below.

List of recently downloaded files similar to the screenshot in our project

At the time the fileā€™s name was hardcoded to ā€œReport.zipā€. So seeing ā€œReport.zipā€, ā€œReport (1).zipā€ or ā€œReport (42).zipā€ was to be expected. Instead of a counter, I was suprised to see a timestamp. Where did that come from? It was absolutely not in the code. My colleague didnā€™t manually add it either. Something was not right. And from here on the rabbit hole got deeper and deeper. šŸ°

ā€œA browser setting!ā€ - I thought. It was rulled out quite quickly because she didnā€™t remember changing any settings. We were looking in Edge because thatā€™s the browser she uses. Besides, such a setting does not exist, I later found out.

ā€œWell, then maybe the browser added it automatically. But at what point?ā€ I started searching on Google, going through different web pages, StackOverflow posts and forums. The more I searched, the more curious I became to figure this out. Then finally - FINALLY - a reply to a Reddit post gave me a pretty strong hint.

But was that still the case? There was only one way to find out. šŸš€

Fired up Edge and started downloading.

1, 2, 3, ... 10, ... 42, ... 99 times.

Then something magical šŸŖ„ happened the 102nd time! Instead of bumping a number, Edge added a timestamp šŸ˜Æ Bingo! šŸŽ‰ The mystery was solved. That explained it.

So to make this more scientific, and for the purpose of this post, I decided to repeat the exercise in other browsers. Here are some screenshots.

Edge

Downloading the same file 102+ times in Edge

Chrome

Downloading the same file 102+ times in Chrome. Same as Edge

Firefox

Firefox just continues with bumping the counter. No timestamp here. Also note that thereā€™s no space between the fileā€™s name and the counter in parenthesis, as is the case in Edge/Chrome.

Downloading the same file 102+ times in Firefox


Update 2025-01-14

After publishing this post I got curious about the behaviour in Edge/Chrome. Since both browsers are Chromium-based, which is open source, I could, in theory, just look it up in the code. I didnā€™t know what to look for. So I asked on Bluesky. Kevin Doyon replied with a link to a method which is responsible for generating a unique filename. Using the ā€œBlameā€ button at the top of the file revealed where each line of code came from. That led me to this commit which describes why the timestamp is added to the filename.

Seems like this is the end of it. Finally peace šŸ•Šļø

Commit description explaining why timestamp is used in filename


What a TIL!

Thanks for reading thus far. Hope you learned something new. See you in another post šŸ˜Š


P.S. If you want to try it yourself, Iā€™ve prepared a zip with an empty text file. Go ahead and download it. 102 times, of course.

Or you can quickly put together a simple demo by linking to a local file.

<a href="./fancy.zip" download>Download</a>
Enter fullscreen mode Exit fullscreen mode
browser Article's
30 articles in total
Favicon
Paypal honey browser extension's coupon scam
Favicon
What is Browser Fingerprinting And How does it Identity Fingerprint?
Favicon
How to Clear Cookies in Flutter Custom Tabs?
Favicon
Browser Quest: Finding the Perfect Alternative to Arc Browser
Favicon
Ensuring Smooth User Experiences: A Comprehensive Guide to Browser Compatibility
Favicon
What BuildingšŸ’» a WebGL App Taught Me About Debugging
Favicon
Wakaruyo - Japanese Text Translation Browser Extension šŸŒ
Favicon
Quick Guide to Cookies, Local Storage, Session Storage, and Other Web Storage Mechanisms
Favicon
Chrome Extension Development - Develop minimal app with TypeScript, React, Tailwind CSS and Webpack
Favicon
Downloading the same file 102+ times
Favicon
Working on a browser extension
Favicon
What happens when you type a URL into the browser
Favicon
Kako reŔiti probleme sa specifičnim stilovima za različite pretraživače
Favicon
Update 100 of the more than 2024 top Google Chrome extensions: improve your browsing!
Favicon
setTimeout - max timeout footgun
Favicon
Step Into Chrome Extension Development: Easy Setup with TypeScript and Webpack
Favicon
How to install Ferdium on Linux
Favicon
How to Clear Browser Cache on Android
Favicon
Browser Extensions: A Frontend Developer's Guide to Building and Deploying Custom Extensions
Favicon
šŸš€ How a Browser Renders a Web Page
Favicon
How Do I Turn JavaScript Off Across Multiple Browsers
Favicon
Free Cross Browser Testing Tools to pick in 2025
Favicon
Parallel Programming in Web Browsers
Favicon
Por Que o Arc Ć© o Melhor Navegador para Mac
Favicon
idk but webkit sucks
Favicon
What is this browser?
Favicon
åœØęµč§ˆå™Øäø­čæ›č”Œę–‡ä»¶ę“ä½œ
Favicon
How Does Proxy in Browser Work with Swiftproxy
Favicon
Swiftproxy Proxy in Browser Solution for Safe and Anonymous Browsing
Favicon
How to get rid of fake followers on X (Twitter)

Featured ones: