
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
FileGroups
File extensions and media types, grouped by application and type. Useful when you need to process or restrict processing to certain types of files.
Methods on FileGroups
return an object containing a set of media
types and file extensions. These are accessible via the .media_types
and .extensions
methods, which return an Array
of String
s. By default only commonly used values are returned.
To return all know values pass true
to either method, e.g., object.media_types(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:
require "file_groups"
FileGroups.image.extensions # ["bmp", "gif", "ico", "jpeg", ... ]
FileGroups.image.media_types # ["image/bmp", "image/x-ms-bmp", "image/gif", ... ]
FileGroups.video.extensions # ["asf", "mov", "qt", "movie", ... ]
FileGroups.video.media_types # ["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.web.extensions(true) # ["bmp", "dib", "gif", "ico", "jfif", "jpe", "jpeg", ... ]
Retrieve a list of file extensions or media types used by spreadsheets:
require "file_groups"
FileGroups.spreadsheet.extensions # ["csv", "xls", "xlsx", "xlt", ... ]
FileGroups.spreadsheet.media_types # ["text/csv", "application/vnd.ms-excel", ... ]
If you only want values specific to CSVs:
FileGroups.spreadsheet.csv.media_types # ["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.media_types # ["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)
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
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
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.