Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Simplify and UNIXify the HTML5 Filesystem API with filer.js

DZone's Guide to

Simplify and UNIXify the HTML5 Filesystem API with filer.js

· Web Dev Zone ·
Free Resource

Bugsnag monitors application stability, so you can make data-driven decisions on whether you should be building new features, or fixing bugs. Learn more.

One of the more ambitious low-level web standards presently under development is the Filesystem API, currently in W3C Working Draft status.

Rather than creating its own local storage space, an application using the Filesystem API can navigate the user's pre-existing local filesystem, within a user-defined sandbox -- thus, like many of these new web technologies, continuing to dissolve the web/local barrier.

Filesystem-appropriately, the API is long and complex.

So Eric Bidelman wrote a wrapper, filer.js, to map some basic filesystem functionality to shorter-syntax and -- here's the awesome rub -- familiar UNIX commands.

From Eric's release announcement

Unlike other libraries [1, 2], filer.js takes a different approach and incorporates some lessons I learned while implementing the Google Docs Python client library. Namely, the library resuses familiar UNIX commands (cp, mv, rm) for its API. My goal was to a.) make the HTML5 API more approachable for developers that have done file I/O in other languages, and b.) make repetitive operations (renaming, moving, duplicating) easier.

That's pretty sweet, I'd say. Why wrap into something just simpler, when you can map onto something you already know?

Check out Eric's announcement, or the github project itself. And long live ls!

Monitor application stability with Bugsnag to decide if your engineering team should be building new features on your roadmap or fixing bugs to stabilize your application.Try it free.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}