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

Learn how to build modern digital experience apps with Crafter CMS. Download this eBook now. Brought to you in partnership with Crafter Software

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!

Crafter is a modern CMS platform for building modern websites and content-rich digital experiences. Download this eBook now. Brought to you in partnership with Crafter Software.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

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

{{ parent.tldr }}

{{ parent.urlSource.name }}