A rework of the NPM xcursor package, which's repository is now a dead link. An archive of what was found via a combination of multiple NPM versions, representing the github repository as close as possible, can be found on the upstream-archive branch.
This project attempts to modernize it by rewriting it in TypeScript using modern TS classes, rather than properties on prototypes of functions, in addition to using esbuild to properly build the project. It retains a very similar API to xcursor; migrating can, in some cases, be as simple as a drop-in.
pnpm i zcursor
import { Decoder } from 'zcursor';
import { readFileSync, writeFileSync } from 'fs';
const arrowData = readFileSync('cursor.cur');
const decoder = new Decoder(arrowData);
for (let i = 0; i < decoder.images(); i++) {
// Loop through all frames of the cursor
const image = decoder.imageInfo(i);
const filename = join(outdir, image.type + '-' + i + '.data'); // Generate a filename
const data = decoder.getData(image); // Uint8Array of the image data, BGRA for some reason
writeFileSync(filename, Buffer.from(data)); // Write the data to a file
}
TBA, read the examples or freebata for the time being.
See examples for detailed usage guides.