Package Exports
- ktx-parse
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ktx-parse) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ktx-parse
KTX 2.0 (.ktx2) parser and serializer.
NOTICE: Work in progress.
Quickstart
npm install --save ktx-parse
const fs = require('fs');
const { read, write } = require('ktx-parse');
// Read data.
const inData = fs.readFileSync('./input.ktx2'); // (a) Node.js
const inData = await fetch('./input.ktx2') // (b) Web
.then((r) => r.arrayBuffer())
.then((buffer) => new Uint8Array(buffer));
// Parse.
const container = read(inData);
// Serialize.
const outData = write(container); // → Uint8Array
API
TODO
Encoding / Decoding
This library reads/writes KTX 2.0 containers, and provides access to the compressed texture data within the container. To decompress that data, or to compress existing texture data into GPU texture formats used by KTX 2.0, you'll need to use additional libraries, described below.
TODO: Describe options for compressing, transcoding, and decompressing KTX 2.0 payloads using Basis Universal.