https://github.com/sapphi-red/node-midec
Multi-image detector (Wasm). cf. Animated GIF, APNG, Animated WebP, Animated HEIF/AVIF.
https://github.com/sapphi-red/node-midec
apng avif gif heif png wasm webp
Last synced: 2 months ago
JSON representation
Multi-image detector (Wasm). cf. Animated GIF, APNG, Animated WebP, Animated HEIF/AVIF.
- Host: GitHub
- URL: https://github.com/sapphi-red/node-midec
- Owner: sapphi-red
- License: mit
- Created: 2021-06-04T02:48:51.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-06-09T07:08:37.000Z (almost 4 years ago)
- Last Synced: 2025-03-18T08:57:50.168Z (2 months ago)
- Topics: apng, avif, gif, heif, png, wasm, webp
- Language: Go
- Homepage:
- Size: 88.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-midec [](https://badge.fury.io/js/node-midec) [](https://github.com/sapphi-red/node-midec/actions/workflows/main_go.yaml) [](https://github.com/sapphi-red/node-midec/actions/workflows/release.yaml)
Multi-image detector (Wasm). cf. Animated GIF, APNG, Animated WebP, Animated HEIF/AVIF.Pure Webassembly + JavaScript port of [midec](https://github.com/sapphi-red/midec).
## Installation
```shell
$ npm i node-midec
```## Example
```js
import { isAnimated } from 'node-midec'
import fs from 'fs/promises'const filePath = new URL('./animated.gif', import.meta.url)
const file = await fs.readFile(filePath)
const result = await isAnimated(file)
console.log(`animated.gif is ${result ? '' : 'not '}an animated image.`)
```## Build
```shell
$ cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" ./lib
$ GOOS=js GOARCH=wasm go build -o lib/main.wasm
```