Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

whether-image

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

whether-image

check a file whether image

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Whether Image

A module used to determine whether a file is a picture. Judge based on the file header.

Installation

npm install whether-image

Usage

// Get Image Real type
import img from 'whether-image';
img.getImageSuffix('your/image/file/path'); 
// => `bmp` or `jpg` or `jpeg` or `png` or `gif` or `webp` or `tiff` or `tif`
// Check is Image
import img from 'whether-image';
img.isImage('your/image/file/path');
// => true or false

Parameters

function getImageSuffix(file: ArrayBufferView | string, suffixs: Array<string>): string 
function isImage(file: ArrayBufferView | string, suffixs: Array<string>): boolean 
parameterdescription
fileThe file path or byte that you want to check.
suffixsThe suffixs list you want to check. (Optional)

Support Image Type

  • You can get it from variable suffixs. There are bmp, jpg, jpeg, png, gif, webp, tiff, tif.

Keywords

FAQs

Package last updated on 08 Feb 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc