Skip to main content
The Deno 2 Release Candidate is here
Learn more

Targadactyl

A .tga file loader for Deno. (Forked from tga-js)

GitHub repository license

Usage Examples

Instantiate the TgaLoader class and pass an Uint8ClampedArray of image data to the load() method before attempting to get the canvas, image data or header information.

A TgaLoaderReferenceError will be thrown by TgaLoader.getImageData(), TgaLoader.getCanvas() and TgaLoader.header if the TGA file has not loaded prior to the method call.

Loading a Local .tga File

(Requires read permission.)

import TgaLoader from "https://deno.land/x/targadactyl/mod.ts";

const tga = new TgaLoader();

tga.load(
  await tga.open("./test/test.tga"),
);

Loading a Remote .tga File

(Requires network permission.)

import TgaLoader from "https://deno.land/x/targadactyl/mod.ts";

const tga = new TgaLoader();
const src = new URL("https://raw.githubusercontent.com/jasonjgardner/targadactyl/main/test/test.tga");

tga.load(
  await tga.fetch(src);
);

Serving a .tga File

Logo .tga file served by Deno
🎉
Serving ./test/test.tga via deno.dev

View in Playground Editor