Detect animated GIFs from JS Buffer/Stream.
npm install is-animated-gif[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![CircleCI][circleci-shield]][circleci-url]
[![ISC License][license-shield]][license-url]
[contributors-shield]: https://img.shields.io/github/contributors/HypernovaTX/is-animated-gif.svg
[contributors-url]: https://github.com/HypernovaTX/is-animated-gif/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/HypernovaTX/is-animated-gif.svg
[forks-url]: https://github.com/HypernovaTX/is-animated-gif/network/members
[stars-shield]: https://img.shields.io/github/stars/HypernovaTX/is-animated-gif.svg
[stars-url]: https://github.com/HypernovaTX/is-animated-gif/stargazers
[circleci-shield]: https://circleci.com/gh/HypernovaTX/is-animated-gif/tree/master.svg?style=shield
[circleci-url]: https://circleci.com/gh/HypernovaTX/is-animated-gif/tree/master
[issues-shield]: https://img.shields.io/github/issues/HypernovaTX/is-animated-gif.svg
[issues-url]: https://github.com/HypernovaTX/is-animated-gif/issues
[license-shield]: https://img.shields.io/github/license/HypernovaTX/is-animated-gif.svg
[license-url]: https://github.com/HypernovaTX/is-animated-gif/blob/master/LICENSE
npm i is-animated-gif
yarn add is-animated-gif
isAnimatedGifStream()
Stream (such as: stream.Stream, stream.Readable, or http.IncomingMessage)
Boolean
ts
const file = path.resolve(./test/files/large-size-not-animated.gif);
const stream = fs.createReadStream(file);
isAnimatedGifStream(stream);
// ...
`
External Image example:
`ts
http.get(
'http://smb3a.weebly.com/uploads/1/0/0/7/1007956/7027030.gif',
async (res) => {
const result = await isAnimatedGifStream(res);
// ...
}
);
`
$3
This function is intended to be used with Buffer:
Function: isAnimatedGif()
Params: Buffer
Returns: Boolean
Example:
`ts
const file = path.resolve('./path/to/file.gif');
const buffer = fs.readFileSync(file);
isAnimatedGif(buffer);
// ...
`
Tests
Simply execute npm test or yarn test` runs the tests.