1.1.14 • Published 1 year ago

zcursor v1.1.14

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

ZCursor Logo

ZCursor

License NPM Codeberg Upstream Examples

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.

Installation

pnpm i zcursor

Usage

Decoding a cursor

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
}

Encoding a cursor

TBA, read the examples or freebata for the time being.

Examples

See examples for detailed usage guides.

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.8-pre1

2 years ago