npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

file-groups

v0.2.0

Published

File extensions and media types, grouped by application and type. Useful when you need to process or restrict processing to certain types of files.

Downloads

321

Readme

file-groups

File extensions and media types, grouped by application and type. Useful when you need to process or restrict processing to certain types of files.

Usage

Properties on file-groups return objects containing a set of media types and file extensions. These are accessible via the mediaTypes and extensions properties, which return an Array of Strings. By default only commonly used values are returned. To return all know values pass true to either, e.g., object.mediaTypes(true)

In some cases additional methods can be called on the object to further restrict the set.

Let's look at some examples.

Images & Video

Retrieve a list of file extensions or media types used by images and video:

const fileGroups = require('file-groups');

fileGroups.image.extensions();  // ["bmp", "gif", "ico", "jpeg", ... ]
fileGroups.image.mediaTypes();  // ["image/bmp", "image/x-ms-bmp", "image/gif", ... ]
fileGroups.video.extensions();  // ["asf", "mov", "qt", "movie", ... ]
fileGroups.video.mediaTypes();  // ["video/x-ms-asf", "video/quicktime", ... ]

Images can be filtered on by raster, vector, or web:

fileGroups.image.web.extensions();     // ["gif", "jpeg", "jpg", "png", "svg", "webp"]
fileGroups.image.raster.extensions();  // ["bmp", "gif", "ico", "jpeg", "jpg", "tif", "tiff", "webp"]
fileGroups.image.vector.extensions();  // ["svg"]

For a complete list pass in true to any of these methods:

fileGroups.image.extensions(true);  // ["bmp", "dib", "gif", "ico", "jfif", "jpe", "jpeg", ... ]

Spreadsheets

Retrieve a list of file extensions or media types used by spreadsheets:

const fileGroups = require('file-groups');

fileGroups.spreadsheet.extensions();  // ["csv", "xls", "xlsx", "xlt", ... ]
fileGroups.spreadsheet.mediaTypes();  // ["text/csv", "application/vnd.ms-excel", ... ]

If you only want values specific to CSVs:

fileGroups.spreadsheet.csv.mediaTypes();  // ["text/csv", "text/comma-separated-values" ]

If you only want values specific to Microsoft Excel:

fileGroups.spreadsheet.excel.extensions();  // ["xls", "xlsx", "xlt", "xltx", "xlw"]
fileGroups.spreadsheet.excel.mediaTypes();  // ["application/vnd.ms-excel", ... ]

Or for OpenOffice Calc:

fileGroups.spreadsheet.calc.extensions();  // ["ods", "ots"]

By default these only return common extensions, to return all:

fileGroups.spreadsheet.excel.extensions(true); // ["xls", "xlsx", "xlt", "xltx", ... ]

Everything Else

See the list of categories and tags.

Author

Skye Shaw (skye.shaw -AT- gmail)

License

https://opensource.org/licenses/MIT