JSPM

is-file-animated

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2442
  • Score
    100M100P100Q121164F
  • License MIT

Detects animated images from file handles e.g. Blob/File or fs.FileHandle

Package Exports

  • is-file-animated
  • is-file-animated/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (is-file-animated) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

is-file-animated

npm ci standard standard version

is-file-animated is a simple library for detecting animated GIF/PNG/WebP images from Blob/File or fs.FileHandle.

Install

npm install is-file-animated

Example

On browsers and similar environments:

import isAnimated from 'https://cdn.jsdelivr.net/npm/is-file-animated/+esm'

const response = await fetch(url)

const blob = await response.blob()
const answer = await isAnimated(blob) ? 'Yes' : 'No'
console.log(`Is "${url}" animated? ${answer}.`)

On Node.js:

import { open } from 'fs/promises'
import isAnimated from 'is-file-animated'

const filename = process.argv[2]

const handle = await open(filename)
const answer = await isAnimated(handle) ? 'Yes' : 'No'
console.log(`Is "${filename}" animated? ${answer}.`)

License

MIT