目录
semantic-release-bot

Release 3.0.0

[skip ci]

3.0.0 (2025-03-12)

⚠ BREAKING CHANGES

  • drop Node.js < 18.19.0 support

part of https://github.com/eggjs/egg/issues/3644

https://github.com/eggjs/egg/issues/5257

  • change mime-db to 1.52.0

Summary by CodeRabbit

  • New Features

  • Rebranded the package as “@eggjs/compressible” with enhanced TypeScript support, updated module exports, and improved type definitions.

  • Documentation

  • Revised the README with new badges, installation instructions, usage examples, and contributor information.

    • Updated LICENSE with a new copyright entry.
  • Refactor

  • Migrated the core compressibility functionality from JavaScript to a streamlined TypeScript implementation.

  • Tests

  • Added comprehensive tests to ensure robust handling of various MIME type inputs.

  • Chores

  • Improved development tooling and updated CI workflows for build, release, and package publishing.

Features

  • support cjs and esm both by tshy (#1) (6d0d7cc)
1年前354次提交

@eggjs/compressible

NPM version Node.js CI Test coverage Known Vulnerabilities npm download Node.js Version PRs Welcome CodeRabbit Pull Request Reviews

Compressible Content-Type / mime checking.

Forked compressible for TypeScript and keep mime-db as same version as mime-types.

Installation

npm install @eggjs/compressible

API

import { compressible } from '@eggjs/compressible';

compressible(type)

Checks if the given Content-Type is compressible. The type argument is expected to be a value MIME type or Content-Type string, though no validation is performed.

The MIME is looked up in the mime-db and if there is compressible information in the database entry, that is returned. Otherwise, this module will fallback to true for the following types:

  • text/*
  • */*+json
  • */*+text
  • */*+xml

If this module is not sure if a type is specifically compressible or specifically uncompressible, undefined is returned.

compressible('text/html') // => true
compressible('image/png') // => false

License

MIT

Contributors

Contributors

Made with contributors-img.

关于
236.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802032778号