Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

supports-webp

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

supports-webp

Instantly detect support for WEBP images in the browser in 0.2KB

latest
Source
npmnpm
Version
3.0.0
Version published
Maintainers
1
Created
Source

supports-webp

Detect support for WEBP images in the browser in 0.3KB

Install

You can download the standalone bundle and include it in your manifest.json.

Or use npm:

npm install --save supports-webp

Usage

import supportsWebP from 'supports-webp';
// supportsWebP is a Promise

supportsWebP.then(supported => {
	if (supported) {
		console.log('Load WebP!');
	} else {
		console.log('Load JPEG!');
	}
});

// Or if you can use async/await:
if (await supportsWebP) {
	console.log('Load WebP!');
} else {
	console.log('Load JPEG!');
}

Keywords

browser

FAQs

Package last updated on 10 Sep 2022

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