I've used that "central directory" approach even over the internet with a great success (downloading just that segment instead of the whole archive to get a list of what is inside).
But how did you make a bookmarklet to produce a zip archive, even non-compressed?
Not quite sure I understand the question. Bookmarklets are bookmarks which contain JavaScript code, for example:
javascript:alert('Hello, World!');
You can put that in a link
<a href="javascript:alert('Hello, World!');">Bookmarklet</a>
and then you can right-click the link to bookmark it. Now, when you want to run that JavaScript code on some website, visit the website and click on the bookmark.
Do you, or do you do something much simpler?
To create the archive data, I used an Uint8Array where I wrote the bytes into.
To download the images, I used XMLHttpRequest.
> I also believed that the bookmarklets are limited to the security context of the web page
That seems to be true unfortunately. However, besides the images on the same domain, it should also be possible to download some more images from other domains by allowing cross origin requests if the remote server cooperates and sets the respective header. but I have not looked into that yet.
The bookmarklet is here if you have more questions: https://github.com/983/FileDownloader
It is a bit larger than 2500 characters now since previously the code was optimized for size. Now it is slightly more readable.
Being able to download individual parts seems good: you could have seperate sha256 info for files for instance.
Bookmarklets are executed in the context of the currently opened website, so downloading images from the same origin is usually not a problem. What can be an issue are remote images. I tried setting `Access-Control-Allow-Origin: *`, but then other downloads would fail, so I left it as it was since it worked for the websites I was interested in.
Here is the code: https://github.com/983/FileDownloader
I've been using this for a javascript bookmarklet (< 2000 characters) which automatically downloads all images from a web page on click.