Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

6. Files > Filesystem

Filesystem

The idea of a browser allowing JavaScript to access the filesystem is enough to send anyone who thinks about security into a panic. There are many things on any user’s hard drive that one would not want the browser to be able to access.

Google Chrome allows JavaScript to access a sandboxed filesystem on the user’s computer. If you want to run the FileSystem API from inside a web page, Chrome must be started with the --unlimited-quota-for-files flag. However, if you are building an app for the Google Web Store you can access this API by specifying unlimitedStorage in the store manifest file.

While localStorage and IndexedDB allow a JavaScript program to store objects in a database, the FileSystem API is useful for storing large binary objects. For example, if you’re building a video app, it may be useful to store working images on a filesystem. Other use cases could include streaming video, games with lots of media assets, image editing, or audio applications. In short, this interface will be a good fit for any application that needs to store a lot of data locally, on a short-term or long-term basis.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial