Socket
Socket
Sign inDemoInstall

image-meta

Package Overview
Dependencies
0
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    image-meta

Detect image type and size using pure javascript


Version published
Weekly downloads
532K
decreased by-1.93%
Maintainers
2
Install size
41.7 kB
Created
Weekly downloads
 

Readme

Source

image-meta

npm version npm downloads bundle Codecov

Detect image type and size using pure javascript.

Usage

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.

Development

  • Clone this repository
  • Install latest LTS version of Node.js
  • Enable Corepack using corepack enable
  • Install dependencies using pnpm install
  • Run interactive tests using pnpm dev

License

Made with 💛

Published under MIT License.

FAQs

Last updated on 18 Oct 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc