@frsource/is-animated
v1.0.1
Published
Detects animated images in browser & node. Supports GIT, APNG & WebP
Downloads
78
Maintainers
Readme
Quick start
Installation
npm install @frsource/is-animated
yarn add @frsource/is-animated
pnpm add @frsource/is-animated
Usage in browser
<input type="file" accept="image/*" />
const input = document.querySelector('input[type="file"]');
input.addEventListener('change', async function () {
const arrayBuffer = await this.files[0].arrayBuffer();
const answer = isAnimated(arrayBuffer) ? 'Yes' : 'No';
alert(`Is "${this.files[0].name}" animated? ${answer}.`);
});
Usage in Node.js
import { readFileSync } from 'fs';
import isAnimated from '@frsource/is-animated';
readFileSync('my-test-file.png', (err, buffer) => {
const answer = isAnimated(buffer) ? 'Yes' : 'No';
console.log(`Is "my-test-file.png" animated? ${answer}.`);
});
For a working example, check out our demo.
Questions
Don’t hesitate to ask a question directly on the discussion board!
Changelog
Changes for every release are documented in the release notes and CHANGELOG file.
Development
- Check out the repository.
- Install dependencies using
pnpm i
. - Run
pnpm test
to run the test suite. - Run
pnpm start
and visithttp://localhost:3000
to see the documentation page. You can test the library using the demo section.
License
MIT @ 2024-present, Jakub FRS Freisler, FRSOURCE
Forked from qzb's great library: is-animated.