![]() | Name | Last modified | Size | Description |
---|---|---|---|---|
![]() | Parent Directory | - | ||
![]() | dist/ | a year ago | - | |
![]() | LICENSE | a year ago | 1.2K | |
![]() | README.md | a year ago | 1.8K | 595aea1 more query options + view options [كارل مبارك] |
![]() | package.json | a year ago | 1.3K | afd0ccc remove unused [كارل مبارك] |
Detect image type and size using pure javascript.
Install package:
# npm
npm install image-meta
# yarn
yarn add image-meta
# pnpm
pnpm install image-meta
# bun
bun install image-meta
import { imageMeta } from "image-meta";
const data = await fetch(url).then((res) => res.buffer());
// Meta contains { type, width?, height?, orientation? }
const meta = imageMeta(data);
Note: imageMeta
throws an error if either data is not a Buffer
/Uint8Array
, or data is invalid or type cannot be determined. You should wrap it into a try/catch
statement to handle errors.
corepack enable
pnpm install
pnpm dev
Made with 💛
Published under MIT License.