📜 ⬆️ ⬇️

Web Bundle - the case of RarJPEG lives

The other day, the first release of a set of tools for packing various web resources into one file - Web Bundle . The principle of its operation is exactly the same as for the resources included in EXE files — arbitrary files are packaged into a single container file, and on the client side, access to them is organized by file name using the API. Only in this case, the PNG image is used as the container. The client part is a small JS-library that allows you to download, decode and extract individual files from such resources.

There should be a picture with a trolley bus from a loaf. Cool, but why ?! After all, all the resources are perfectly loaded and unpacked in a container, and even parallel. This is an ambiguous question. On the one hand, resource loading with one file can be faster than even parallel loading of many small files, especially on a mobile connection with high latency. On the other hand, for a long time there are technologies for merging similar resources into one file, such as scripts, style sheets, icons. Yes, and widespread HTTP 2.0 should soon solve this problem. But still the Web Bundle has some advantages.

Versatility. You can pack absolutely any files, up to binary ones. On some hosting with MIME restrictions, the type of downloadable files cannot be downloaded or given to the client by an arbitrary file.

Fast decoding. The PNG format is decoded by the browser itself, the output is an “image”, which visually does not carry anything meaningful and looks like colored noise. Instead of the pixel color values, there is the contents of the resource files, which are retrieved by the client library using the Canvas.
')

There are three files in this image.

For convenience, methods are provided for reading a resource as text, as a JSON object, and as an image.

The success of this technology will depend on whether there is a real use for it. And it may be very different. For example, can it be used for covert malware delivery to a client? Probably can. But AV vendors are likely to respond quickly and add the appropriate module unpacking and analysis. So for users it will not be a big problem. But for any photo- and screenshot-hosting can be a problem, if they have to scan all the files uploaded by users, it will increase the load on the server.

UPD:
As iSage suggested, this idea was already implemented in PNGfy in 2009 (the Canvas was already then!), But only for one file.

Source: https://habr.com/ru/post/254907/


All Articles