百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
I

is-progressive

> 编程语言
开源

检查 JPEG 图像是否为渐进式

199 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

检查 JPEG 图像是否为渐进式

is-progressive

Check if JPEG images are progressive

Can be useful to make sure your images are progressive, which is important for performance:

Progressive JPEGs are better because they are faster. Appearing faster is being faster, and perceived speed is more important that actual speed. - Progressive JPEGs: a new best practice

The check is fast as it only reads a small part of the file.

Install

npm install is-progressive

Usage

import isProgressive from 'is-progressive';

console.log(await isProgressive.file('baseline.jpg'));
//=> false

isProgressive.fileSync('progressive.jpg');
//=> true
// Check if a remote JPEG image is progressive without downloading the whole file
import https from 'node:https';
import isProgressive from 'is-progressive';

const url = 'https://raw.githubusercontent.com/sindresorhus/is-progressive/main/fixture/progressive.jpg';

https.get(url, async response => {
	console.log(await isProgressive.stream(response));
	//=> true
});

API

Prefer the file methods if you're dealing directly with files. Those methods are optimized to read in the least amount of bytes necessary to determine whether it's a progressive JPEG image.

.buffer(buffer)

Returns whether the buffer is a progressive JPEG image.

buffer

Type: Uint8Array

The buffer of a JPEG image.

Must be at least 65535 bytes when the file is larger than that.

.stream(stream)

Returns a Promise indicating whether the file stream is a progressive JPEG image.

stream

Type: stream.Readable

A data stream with a JPEG image.

.file(filePath)

Returns a Promise indicating whether the file at the filePath is a progressive JPEG image.

filePath

Type: string

The file path to the image.

.fileSync(filePath)

Whether the file at the filePath is a progressive JPEG.

filePath

Type: string

The file path to the image.

Build-system integration

Don't use this with a build-system like Gulp/Grunt as you can easily make the images progressive with the imagemin (Gulp/Grunt-task) progressive option instead of just warning about it.

Related

  • is-progressive-cli - CLI for this module

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言