Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Poepping committed Nov 6, 2020
0 parents commit 9fb9602
Show file tree
Hide file tree
Showing 35 changed files with 2,805 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .acsemver.js
@@ -0,0 +1,13 @@
module.exports = {
repository: {
url: 'https://github.com/mmpro/ac-file-extensions'
},
jira: {
url: 'https://mmpro.atlassian.net'
},
changelogFile: __dirname + '/CHANGELOG.md',
sections: [
{name: 'App'},
{name: 'Misc'}
]
};
27 changes: 27 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,27 @@
module.exports = {
root: true,
'env': {
'commonjs': true,
'es6': true,
'node': true
},
'extends': 'eslint:recommended',
'globals': {
'Atomics': 'readonly',
'SharedArrayBuffer': 'readonly',
'GlobalHelper': 'readonly',
'acapi': 'readonly'
},
'parserOptions': {
'ecmaVersion': 2018
},
'rules': {
"space-before-function-paren": 0,
"no-extra-semi": 0,
"object-curly-spacing": ["error", "always"],
"brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
"no-useless-escape": 0,
"standard/no-callback-literal": 0,
"new-cap": 0
},
};
60 changes: 60 additions & 0 deletions .gitignore
@@ -0,0 +1,60 @@
########################
# node.js / npm
########################
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
*.file

pids
logs
results

node_modules

########################
# misc / editors
########################
*~
*#
**/.DS_STORE/**
**/.netbeans/**
**/nbproject/**
**/.idea/**
**/tracegl.js/**
**/sftp-config.json/**
**/tmp/**
**TODO.md**
.vscode/**

########################
# docs / tests
########################

coverage.html
**/test/suites/localTest.js
**/test/testpid.file
report.xml
**error.log
**messageLog**
**testNotification**
**testlist**
credentials**
testLogs**

########################
# local config
########################
config/env/**
config/privateKeys/**
config/ssl/**
.jenkins.conf

installers/**

index.js
Empty file added CHANGELOG.md
Empty file.
10 changes: 10 additions & 0 deletions Makefile
@@ -0,0 +1,10 @@
lint-fix:
./node_modules/.bin/eslint "sources/**" --fix

commit:
@node ./node_modules/ac-semantic-release/lib/commit.js

release:
@node ./node_modules/ac-semantic-release/lib/release.js

.PHONY: check
41 changes: 41 additions & 0 deletions README.md
@@ -0,0 +1,41 @@
# 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.

# 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.

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

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

# Usage
```
const fileExtensions = require('ac-file-extensions')
const result = fileExtensions.find( ext => ext.ext === 'mp4' )
console.log(result)
// { "ext": "mp4", "name": "MPEG-4 Video", "mimetype": "video/mp4" }
```

# 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.

## Links
- [Website](https://www.admiralcloud.com/)
- [Twitter (@admiralcloud)](https://twitter.com/admiralcloud)
- [Facebook](https://www.facebook.com/MediaAssetManagement/)

## License
[MIT License](https://opensource.org/licenses/MIT) Copyright © 2009-present, AdmiralCloud, Mark Poepping
19 changes: 19 additions & 0 deletions createFile.js
@@ -0,0 +1,19 @@
const fs = require('fs')
const _ = require('lodash')

const index = _.last(__filename.split('/'))
const sourceFiles = _.pull(fs.readdirSync('./sources'), index)
const fileToWrite = './index.js'

let sources = []

_.forEach(sourceFiles, function(file) {
let source = JSON.parse(fs.readFileSync('./sources/' + file).toString())
sources = _.concat(sources, source)
})

// write to file which is then used
let data = 'module.exports = ' + JSON.stringify(sources, null, 2)
fs.writeFile(fileToWrite, data, function(err) {
if (err) throw err
})
22 changes: 22 additions & 0 deletions package.json
@@ -0,0 +1,22 @@
{
"name": "ac-file-extensions",
"version": "1.2.0",
"description": "Creates a list of file extensions and their \"real\" names",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"postinstall": "node createFile.js"
},
"author": "Mark Poepping/mmpro",
"contributors": [
"Florian Timme/mmpro"
],
"license": "MIT",
"dependencies": {
"ac-semantic-release": "^0.2.5",
"lodash": "^4.17.20"
},
"devDependencies": {
"eslint": "^7.12.1"
}
}
27 changes: 27 additions & 0 deletions sources/3.json
@@ -0,0 +1,27 @@
[
{
"ext": "3fr",
"name": "Hasselblad 3F RAW Image",
"mimetype": "image/x-hasselblad-3fr"
},
{
"ext": "3g2",
"name": "3GPP2 Multimedia",
"mimetype": "video/3gpp2"
},
{
"ext": "3gp",
"name": "3GPP Multimedia",
"mimetype": "video/3gpp"
},
{
"ext": "3gp2",
"name": "3GPP Multimedia",
"mimetype": "video/3gpp2"
},
{
"ext": "3gpp",
"name": "3GPP Media",
"mimetype": "video/3gpp"
}
]
7 changes: 7 additions & 0 deletions sources/7z.json
@@ -0,0 +1,7 @@
[
{
"ext": "7z",
"name": "7-Zip",
"mimetype": "application/x-7z-compressed"
}
]
107 changes: 107 additions & 0 deletions sources/a.json
@@ -0,0 +1,107 @@
[
{
"ext": "ai",
"name": "Adobe Illustrator",
"mimetype": "application/postscript"
},
{
"ext": "aa",
"name": "Audible Audio",
"mimetype": "audio/audible"
},
{
"ext": "aac",
"name": "Advanced Audio Coding",
"mimetype": "audio/vnd.dlna.adts"
},
{
"ext": "aax",
"name": "Audio Audio Extended",
"mimetype": "audio/vnd.audible.aax"
},
{
"ext": "adt",
"name": "AdTech Fax",
"mimetype": "audio/vnd.dlna.adts"
},
{
"ext": "adts",
"name": "Audio Data Transport Stream",
"mimetype": "audio/vnd.dlna.adts"
},
{
"ext": "addin",
"name": "Visual Studio Add-in Definition",
"mimetype": "text/xml"
},
{
"ext": "aif",
"name": "Audio Interchange File",
"mimetype": "audio/aiff"
},
{
"ext": "aifc",
"name": "Audio Interchange Format Compressed",
"mimetype": "audio/aiff"
},
{
"ext": "aiff",
"name": "Audio Interchange File Format",
"mimetype": "audio/x-aiff"
},
{
"ext": "application",
"name": "Deployment Manifest",
"mimetype": "application/x-ms-application"
},
{
"ext": "arw",
"name": "Sony Alpha Raw",
"mimetype": "image/x-sony-arw"
},
{
"ext": "asax",
"name": "ASP.NET Server Application",
"mimetype": "application/xml"
},
{
"ext": "ascx",
"name": "ASP.NET User Control",
"mimetype": "application/xml"
},
{
"ext": "ashx",
"name": "ASP.NET Web Handler",
"mimetype": "application/xml"
},
{
"ext": "asf",
"name": "Advanced Streaming Format",
"mimetype": "video/x-ms-asf"
},
{
"ext": "asmx",
"name": "ASP.NET Web Service",
"mimetype": "application/xml"
},
{
"ext": "aspx",
"name": "Active Server Page Extended",
"mimetype": "application/xml"
},
{
"ext": "asx",
"name": "Microsoft Advanced Streaming Redirector",
"mimetype": "video/x-ms-asf"
},
{
"ext": "au",
"name": "Audacity Audio",
"mimetype": "audio/basic"
},
{
"ext": "avi",
"name": "Audio Video Interleave",
"mimetype": "video/avi"
}
]
32 changes: 32 additions & 0 deletions sources/b.json
@@ -0,0 +1,32 @@
[
{
"ext": "bmp",
"name": "Bitmap",
"mimetype": "image/bmp"
},
{
"ext": "btapp",
"name": "uTorrent Application",
"mimetype": "application/x-bittorrent-app"
},
{
"ext": "btinstall",
"name": "uTorrent Installer",
"mimetype": "application/x-bittorrent-appinst"
},
{
"ext": "btkey",
"name": "uTorrent License Key",
"mimetype": "application/x-bittorrent-key"
},
{
"ext": "btsearch",
"name": "BitTorrent Search Engine",
"mimetype": "application/x-bittorrentsearchdescription+xml"
},
{
"ext": "btskin",
"name": "uTorrent Skin",
"mimetype": "application/x-bittorrent-skin"
}
]

0 comments on commit 9fb9602

Please sign in to comment.