Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ac-file-extensions

AdmiralCloud49MIT2.0.10

Creates a list of file extensions and their "real" names

readme

AdmiralCloud File Extension List

This little helper creates a list of file extensions including their "real" name and mimetype.

Use it to determine mimetype from extenstion, a prettyfied name or vice versa.

Currently support more than 300 file types.

BREAKING CHANGES Version 2

If you upgrade to version 2, please note that there a breaking changes. While version 1 only provided a list of file extensions, version 2 can be used to easily query extensions.

Installation

Use yarn add ac-file-extensions or npm install ac-file-extensions.

After installation this package will automatically create the collection.js file from sources.

Usage

const fileExtensions = require('ac-file-extensions')

// search from mp4
const result = fileExtensions.query({ ext: 'mp4' })
console.log(result) 
// { "ext": "mp4", "name": "MPEG-4 Video", "mimetype": "video/mp4" }

// retrieve the whole list
fileExtensions.list()

You can use query with parameter:

  • ext -> will return an object for this extension
  • mimeType -> will return an array of objects matching this mimetype

Contribution

If you want to add a new file extension, choose the right folder and add it like the other file extension. Use pull requests to send updates.

To commit, add it with git-add (or any GUI) and then use "make commit" on the CLI and answer the questions there. If you're done and want to release a new version, run "make release".

Publishing to npm must be done manually.

ac-file-extensions vs file-extensions

Please note, that this package is the successor of file-extensions. That's why it starts with version 1.2.0.

Please do not use package file-extensions any longer.

License

MIT License Copyright © 2009-present, AdmiralCloud AG, Mark Poepping

changelog

2.0.10 (2024-07-22 09:58:33)

Bug Fix

2.0.10 (2024-07-17 13:44:50)

Bug Fix

2.0.9 (2024-06-03 15:29:36)

Bug Fix

2.0.8 (2023-12-20 12:51:03)

Bug Fix

2.0.7 (2023-11-16 13:19:46)

Bug Fix

2.0.6 (2023-11-15 11:57:44)

Bug Fix

2.0.5 (2022-04-20 11:40:09)

Bug Fix

2.0.4 (2022-04-20 11:38:28)

2.0.3 (2022-01-21 13:14:24)

Bug Fix

2.0.2 (2022-01-20 15:25:01)

Bug Fix

2.0.1 (2022-01-20 13:21:55)

Bug Fix

2.0.0 (2021-11-06 14:48:05)

Feature

1.2.1 (2021-10-09 10:04:37)

Bug Fix