compressible
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
mime-db | 1.52.0 | 26.36 kB | MIT | prod |
Compressible is an essential npm package for working with Content-Type or mime types. Its primary purpose is to check if a given Content-Type is compressible. The package makes use of the mime-db, a comprehensive database featuring compressible information. Furthermore, if a type's compressibility isn't recognizably definitive, Compressible will return undefined.
To use the Compressible npm package, you should first ensure its successful installation in your project via the command:
$ npm install compressible
After that you can start using it by requiring it in your JavaScript file:
var compressible = require('compressible')
The package provides a compressible
function that you can use to check if a given Content-Type
is compressible. The function takes a type
argument, which should be a MIME type or Content-Type string:
compressible('text/html') // => true
compressible('image/png') // => false
In the above example, 'text/html' is compressible, so the function returns true
, while 'image/png' is not compressible, and so false
is returned.
The Compressible documentation, or docs, can be found directly within the npm package page here, which also directly links it to its associated GitHub repository. The README file on the npm and GitHub page contains the basic details necessary to understand its installation and usage. For more detailed information, you could delve into the source code, available at https://github.com/jshttp/compressible.