

Show HN: A Chrome extension that prevents duplicate downloads - yefim323
https://chrome.google.com/webstore/detail/have-i-downloaded-this-be/apjambapclnlphnllchfdlmhaijeamah

======
alexsb92
Can't wait to try this out. Some of the course files on my university's
website are in .docx format instead of .pdf and I always forget I've
downloaded them before, so by the end of the semester I end up with 7 copies
of the same file.

As an aside, one of the problems I've had with certain Chrome Extensions is
that the Chrome Webstore is telling me that "This application is not supported
on this computer. Installation has been disabled." I started noticing this
when I upgraded to Win 8 from my Win 7, and when I looked it up it was
something about NPAPI plugins being disabled for Chrome on Windows 8. However
this [1] and [2] make it seem that this is only for Chrome in metro mode, but
I've been getting this message in Desktop mode as well. Now I don't know
anything about Chrome extensions and file system access, but it would be great
if it can be coded using some other kind of plugin. There is a workaround for
Chrome/Win8 [3] but it does require a bit of work and it will put people off
from installing it if they have to jump through those hoops.

[1] ([https://groups.google.com/forum/#!topic/tincr-for-chrome-
dev...](https://groups.google.com/forum/#!topic/tincr-for-chrome-
devtools/q_cXN5l6kkU))

[2] ([http://blog.chromium.org/2012/07/npapi-plug-ins-in-
windows-8...](http://blog.chromium.org/2012/07/npapi-plug-ins-in-
windows-8-metro-mode.html))

[3] ()[http://blog.chromium.org/2012/07/npapi-plug-ins-in-
windows-8...](http://blog.chromium.org/2012/07/npapi-plug-ins-in-
windows-8-metro-mode.html)

~~~
yefim323
I apologize for the lack of support. Chrome's download API
(<https://developer.chrome.com/dev/extensions/downloads.html>) is very flaky
and has just been added full support in Chrome 27.0.1448.0 dev-m according to
[http://stackoverflow.com/questions/15451313/closed-
uncaught-...](http://stackoverflow.com/questions/15451313/closed-uncaught-
typeerror-cannot-call-method-download-of-undefined)

~~~
anigbrowl
Ah, that explains a lot. This looks useful because I often have an itchy
trigger finger and download more than one copy. But you know what I really
miss in Chrome would be a decent download manager that lets me select multiple
files from one page instead of DLing them one at a time. Last time I looked
the only extension for this practically announced itself as malware.

~~~
yefim323
Funnily enough, this extension exists as a sample extension in the Chrome
extension docs. Apparently, you can't link to specific samples, so just go to
<https://developer.chrome.com/dev/extensions/samples.html> and filter by
"downloads." The extension you're looking for is "Download Selected Links."

It looks like this: <http://i.imgur.com/XF6S0mu.png>

~~~
anigbrowl
+20 internets to you - that's a serious time-saver for me!

------
yefim323
Source is up here: <https://github.com/yefim323/Have-I-Downloaded-This-Before>

------
quasque
It's a good idea, but downloading something from the same URL (or filename
fragment from an URL) does not necessarily imply that it's a duplicate. Would
be interesting to see something similar to this extension that uses attributes
sent at the start of an HTTP response - e.g. entity tag or content length -
for duplicate checking.

~~~
yefim323
I was thinking of also checking for the same file size. Would that improve the
accuracy of detecting duplicates?

~~~
irrelative
It would, but you'd have to first download the whole file to check which is
probably counter productive. Consider storing some http header values such as
a reference to the Etag header if provided, and checking that value before
saving twice. Also consider storing Cache-Control headers, and Expires
headers. The Content-Length header would be a way to detect same file size
before transferring the whole file, but for large file downloads which used
chunked encoding.

Some resources:

<http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html>

<http://en.wikipedia.org/wiki/Chunked_transfer_encoding>

<http://en.wikipedia.org/wiki/HTTP_ETag>

I'm glad you're addressing this problem! I always end up with file(1).zip in
my downloads folder.

------
jes5199
I don't want a choice! I want it to do the right thing.

------
pulak
What happens if I've deleted the file from my downloads folder? Is that
considered to be "downloaded before"?

~~~
yefim323
Nope, it doesn't count. The Chrome downloads API allows me to makes sure the
file exists on disk.

------
gailees
What's the point? I don't mind downloading it right there again at all...

~~~
yefim323
It's a passive way of notifying you that you already have this file on disk.
You can resume the download if you want to keep the second file.

------
drivebyacct2
How about one that just keeps it from closing when there is a download in
progress? So frustrating when that happens.

