The DeviceStorage API is basically a simple file system API mostly optimized for these types of files. files that aren’t specific to a website, but rather resources that are managed and owned by the user and that the user might want to access through several apps.
#Mozilla firefox cnet download full
This API allows full file system capabilities for “user files”. To satisfy that use-case we have the DeviceStorage API. This is something that the FileSystem API submitted to W3C doesn’t actually provide, though many people seems to think it does. The second most common thing that people ask for related to a file system APIs is to be able to access things like the user’s picture or music libraries. However I’m not sure if IE does the same, so check there first before relying on it. This is completely transparent to the web page, the only thing it will notice is faster writes and less resource use. Writing further references to the same Blob just adds to an internal reference counter. It does not bloat the database itself slowing down other operations, and reading from the file means that the implementation just reads from an OS file, so it’s just as fast as a filesystem.įirefox IndexedDB implementation is even smart enough that if you store the same Blob multiple files in a IndexedDB database it just creates one copy of the file. This means that performance of storing a file in IndexedDB is just as good as storing the file in a filesystem. In Firefox’s IndexedDB implementation (and I believe IE’s too) the files are transparently stored outside of the actual database. So for example, if you were building a web based email client, you could store an object like:Īnother advantage here is that there’s no need to make up file names for resources. Using this, you can store all information that you need in one place, and a single query to IndexedDB can return all the data you need. This is specified by the IndexedDB spec and so far implemented in both the Firefox and IE implementations of IndexedDB. You can write a File or a Blob into IndexedDB just like you can store strings, numbers and JavaScript objects. IndexedDB treats file data just like any other type of data. Especially when there is a solution which can store both structured data as well as file data. However it seems a bit non-optimal to me to have to store some data separated from the rest. Today, people generally solve this by storing the images and sound files in a file system, and then store the file names of those files along with things like speed and firepower of the enemy. For example an enemy space ship might have a few associated images, as well as a couple of associated sounds, used when the enemy is moving around the screen and shooting. Games are a very common type of application where this is needed. This is useful if you need quick access to the resources, or if you want to be able to access them even if the user is offline. Probably the most common thing that people want to do is to simply store a set of resources so that they are available without having to use the network. In my opinion most, but so far not all, of these problems have better solutions than the FileSystem API. But note that this post represents my personal opinion, intended to spur more conversation on this topic.Īs stated above, people asking for “FileSystem API support” in Firefox are actually often interested in solving many different problems. This blog post is an attempt at giving my answer to this question and explain why we haven’t implemented the above two specifications. The specifications are quite big and feature full, so it’s no surprise that people are wanting to do very different things with it. The answer is somewhat complex, and depends greatly on what exact capabilities of the above two specifications the person is actually wanting to use. Usually, but not always, they are referring specifically to the FileSystem and FileWriter specifications which Google is implementing in Chrome, and which they have proposed for standardization in W3C. A question that I get asked a lot is why Firefox doesn’t support the FileSystem API.