Wednesday, August 24, 2011

Using the HTML5 Filesystem API

Using the HTML5 Filesystem API - O'Reilly Media (Amazon.com link, Safari Books Online link, my review on Amazon.com, my review on O'Reilly.com)
4 stars

This is a short introduction to the HTML5 Filesystem API, but with an emphasis on the Google Chrome implementation. The author states that at the time of writing this book, only the Chrome browser implemented the API. Furthermore, the HTML5 spec itself is evolving, and is subject to change ("Take my word of caution and realize that until the spec is final, portions of the API could change." - pg 3). An ample number of code examples makes this a good read however. Even if you are not going to be doing programming where this information would be useful (as is the case with me), this is a short book that still provides you with a quick reckoner of what the API provides.

The topics covered in this short 58 page book are:

Storage and quota, including temporary, persistent, and unlimited storage.


"Local disk usage and IO bandwidth—this is mitigated in part through quota limitations.
Leakage or erasure of private data—this is mitigated by limiting the scope of the HTML5 filesystem to a chroot-like, origin-specific sandbox.
Storing malicious executables or illegal data on a user’s system—with any download there is a risk. The API mitigates against malicious executables by restricting file creation/rename to nonexecutable extensions..." 

Working with files and directories using the API, including what a file entry looks like, how to import, read, remove, create and append data to files. On the topic of directories, subdirectories and recursively removing a directory is also covered.

You can use the html input tag to import files - single or multiple:  <input type=“file”> or  <input type=“file” multiple> or <input type=“file” webkidirectory>.
Yet another way to import files is to use XMLHttpRequest or the new XMLHttpRequest specification that "now exposes responseType and response properties to inform the browser what format to return data in: xhr.responseType"


The Synchronous API is the last topic covered in the book.

While I do not write code in my job nowadays, this short book did provide me with some information on this important component of HTML5.

Product Details:

  • Title: Using the HTML5 Filesystem API
  • By: Eric Bidelman
  • Publisher: O'Reilly Media
  • Formats: Print, Ebook, Safari Books Online
  • Print: July 2011 (est.)
  • Ebook: July 2011
  • Pages: 74 (est.)
  • Print ISBN: 978-1-4493-0945-9
  • ISBN 10: 1-4493-0945-3
  • Ebook ISBN: 978-1-4493-0944-2
  • ISBN 10: 1-4493-0944-5


       





© 2011, Abhinav Agarwal. All rights reserved.