📜 ⬆️ ⬇️

File API: read javascript files from the computer of the site visitor (by consent of this visitor)

Today, PsychodelEKS accurately noted about the Javascript file compression API , the newly built Yahoo in BrowserPlus:
I thought that they had ported the compression algorithm to js, ​​but it turned out that this is just a browser interface to the archiver =)

But the ability to compress large amounts of text (json) data on the client side before sending it to the server would be convenient in modern web applications.
The end of the quote.

On this topic, I am very pleased to tell you all the good news: in the depths of the W3C, editor Arun Ranganathan (Arun Ranganathan) is preparing a draft of the File API standard, largely supported by Firefox’s fresh nightly builds. This standard defines specific APIs by means of which javascript can read files on a user's machine, then convert them in different ways , producing “data: ...” or base64-encoded strings, if necessary , and then do whatever you want with them ( for example, send to server, or use in javascript, or in CSS ...).
')
Accordingly, as soon as some kind soul port the algorithms of archivers to javascript, it will immediately be possible to compress files with javascript before sending them to a remote server.

(This is the very thing that the new BrowserPlus API does, so then it will not be needed for this purpose, but rather one Firefox will be enough.)

In the meantime, this has not happened yet, I suggest you see one spectacular application recently mentioned on hacks.mozilla.org - it is called Font Dragr , it is hung on a certain site and allows the reader of the site to drop (drag-n-drop) on the page of this site which any font file from your own disk so that this page is displayed on the site with this particular font. It starts to be displayed immediately, since the file is not transferred to the server, but is converted and fed to the browser through CSS.

In particular, it is useful for the developer of such a site so that he does not have to edit the CSS on the server every time. With such a page, you can even work offline.

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


All Articles