parse-dds

Parses DDS texture headers in Node and the browser.
This was adapted from @toji's wonderful webgl-texture-utils.
Currently this only supports a limited range of common DDS formats:
See test/index.js for an example in Node, or demo/index.js for a WebGL compressed texture example.
Pull requests welcome.
Example
var parse = require('parse-dds')
var buffer = new Uint8Array(... DDS file ...)
var dds = parse(buffer)
console.log(dds.format)
console.log(dds.shape)
console.log(dds.images)
var image = dds.images[0]
var texture = new Uint8Array(buffer, image.offset, image.length)
Install
npm install parse-dds --save-dev
Usage

dds = parse(arrayBuffer)
Parses an ArrayBuffer and returns the DDS headers for that file.
The returned values:
shape
an array representing the [ width, height ]
of the texture
flags
the DDS bit flags stored in the file
format
a string, either 'dxt1'
, 'dxt3'
, 'dxt5'
, 'rgb32f'
or 'rgba32f'
images
a list of information to extract sub-arrays for each mipmap level
Each image has the form:
{
shape: [ width, height ],
offset: x,
length: len,
}
License
MIT, see LICENSE.md for details.