
Security News
Node.js Moves Toward Stable TypeScript Support with Amaro 1.0
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
file-groups
Advanced tools
File extensions and media types, grouped by application and type. Useful when you need to process or restrict processing to certain types of files.
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.
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 String
s. 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.
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", ... ]
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", ... ]
See the list of categories and tags.
Skye Shaw (skye.shaw -AT- gmail)
FAQs
File extensions and media types, grouped by application and type. Useful when you need to process or restrict processing to certain types of files.
The npm package file-groups receives a total of 414 weekly downloads. As such, file-groups popularity was classified as not popular.
We found that file-groups demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.