kriskowal/zip — pull request #13 by deathcap (2014-01-19 02:25:58+00:00)
Title: Port to use bops for binary operations

Changed to use the [bops](https://npmjs.org/package/bops) module, adding native support for both `Buffer` (in NodeJS) and `Uint8Array ArrayBuffer` (in the browser).

This is an improvement over https://github.com/kriskowal/zip/pull/12 - which added browserify 3 compatibility, but there is a problem on Firefox: [native-buffer-browserify](https://npmjs.org/package/native-buffer-browserify) is backed by `Object`, which is much slower than Typed Arrays:

> (Note: currently even Firefox isn't using the Typed Array implementation because of [this bug](https://bugzilla.mozilla.org/show_bug.cgi?id=952403).)

For my purposes, I wanted to pass the unzipped data from `zip` to a browser API only accepting typed arrays (the W3C [File API](http://www.w3.org/TR/FileAPI/), if you're curious). Worked fine on Chrome where `Buffer` is backed by `Uint8Array`, but on Firefox I get back an `Object` instead, which has to be manually converted to a typed array (iterating over each element, extremely slow).

bops solves this problem, providing an abstracted API for using typed arrays in the browser and Buffers in NodeJS. Works great =)