js-platform/filer — pull request #253 by humphd (2014-08-16 21:18:31+00:00)
Title: Fix #227 - improve efficiency of provider API

This splits our provider get/put calls into `Object` and `Buffer` versions, allowing for greater optimizations within the providers themselves. Because we now have a specialized way to request a `Buffer` from the provider, we don't need the extra `ensureBuffer` check we used to do, so I've removed that.

I've updated the providers we ship to reflect the API change. IndexedDB and Memory can store `ArrayBuffer` without serialization, whereas with WebSQL I base64 encode it. I then use the code @secretrobotron wrote to allow `Filer.Buffer(arrayBuffer)` and hand back a Filer Buffer. It works great.

I've refactored the tests to share a common base, since all of the providers should be able to do the same thing, and added a test case for zero-length Buffers, which we use in various places, and are an edge case for certain provider serialization (i.e., WebSQL).

Finally, I've fixed some random errors in our test code where we had typos or were mixing sync and async code paths, and this new code exposed.

I've run the tests on Mac in Chrome (IndexedDB and WebSQL), Safari (WebSQL), Firefox (IndexedDB), and node.js (Memory), and all are passing 100%