{"id":23338234,"url":"https://github.com/geofmureithi-zz/filetypes","last_synced_at":"2025-04-09T22:30:53.857Z","repository":{"id":57235943,"uuid":"97672682","full_name":"geofmureithi-zz/filetypes","owner":"geofmureithi-zz","description":"Filetypes is a Javascript library that helps you  validate or guess the file and mine types of files using magic numbers","archived":false,"fork":false,"pushed_at":"2017-11-13T12:39:05.000Z","size":8,"stargazers_count":4,"open_issues_count":2,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-05T04:36:15.693Z","etag":null,"topics":["files","filetype","javascript","magic-numbers","mime","node"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/filetypes","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geofmureithi-zz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-19T04:25:47.000Z","updated_at":"2022-08-03T01:23:32.000Z","dependencies_parsed_at":"2022-08-23T15:50:57.629Z","dependency_job_id":null,"html_url":"https://github.com/geofmureithi-zz/filetypes","commit_stats":null,"previous_names":["geofmureithi/filetypes"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geofmureithi-zz%2Ffiletypes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geofmureithi-zz%2Ffiletypes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geofmureithi-zz%2Ffiletypes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geofmureithi-zz%2Ffiletypes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geofmureithi-zz","download_url":"https://codeload.github.com/geofmureithi-zz/filetypes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248123279,"owners_count":21051434,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["files","filetype","javascript","magic-numbers","mime","node"],"created_at":"2024-12-21T03:12:49.228Z","updated_at":"2025-04-09T22:30:53.816Z","avatar_url":"https://github.com/geofmureithi-zz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Small and dependency free [Javascript](https://js.org/) library to infer file type and MIME type checking the [magic numbers](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) signature of a file or buffer.\n\nThis is a Javascript port from [filetype](https://github.com/h2non/filetype) Go package.\n\n\nFeatures\n--------\n\n- Simple and friendly API\n- Supports a [wide range](#supported-types) of file types\n- Provides file extension and MIME type inference\n- File discovery by extension or MIME type\n- File discovery by kind (image, video, audio...)\n- Only first 261 bytes representing the max file header is required, so you can just [pass a list of bytes]\n- Dependency free\n- Cross-platform file recognition\n\n\nInstallation\n------------\n\n    npm install filetypes\n\n\nAPI\n---\nTODO\n\n\nExamples\n--------\n\n#### Simple file type checking\n\n```javascript\nconst FileTypes = require('filetypes');\n//Just Check extension\nlet extension = FileTypes.guessMineType('Nicki Minaj - Anaconda.mp4');\n/**\n{ name: 'mp4',\n  mine: 'video/mp4',\n  extension: 'mp4',\n  match: [Function: match] }\n*/\n//Check extension and Magic_numbers in file;\nlet extension = FileTypes.guessMineType('../path/to/Nicki Minaj - Anaconda.mp4', true);\n\n//Check if extension is Supported\nFileTypes.isMineSupported(\"mp4\")\n//true\nFileTypes.isMineSupported(\"xxs\")\n//false\n\n\n```\n#### collective type checking\n\n```javascript\nlet { isAudio, isImage, isArchive, isFont, isVideo } = require('filetypes');\nisAudio('../path/to/Nicki Minaj - Anaconda.mp4')\n//false\nisVideo('../path/to/Nicki Minaj - Anaconda.mp4')\n//true\n\n```\n\nSupported types\n---------------\n\n#### Image\n\n- **jpg** - `image/jpeg`\n- **png** - `image/png`\n- **gif** - `image/gif`\n- **webp** - `image/webp`\n- **cr2** - `image/x-canon-cr2`\n- **tif** - `image/tiff`\n- **bmp** - `image/bmp`\n- **jxr** - `image/vnd.ms-photo`\n- **psd** - `image/vnd.adobe.photoshop`\n- **ico** - `image/x-icon`\n\n#### Video\n\n- **mp4** - `video/mp4`\n- **m4v** - `video/x-m4v`\n- **mkv** - `video/x-matroska`\n- **webm** - `video/webm`\n- **mov** - `video/quicktime`\n- **avi** - `video/x-msvideo`\n- **wmv** - `video/x-ms-wmv`\n- **mpg** - `video/mpeg`\n- **flv** - `video/x-flv`\n\n#### Audio\n\n- **mid** - `audio/midi`\n- **mp3** - `audio/mpeg`\n- **m4a** - `audio/m4a`\n- **ogg** - `audio/ogg`\n- **flac** - `audio/x-flac`\n- **wav** - `audio/x-wav`\n- **amr** - `audio/amr`\n\n#### Archive\n\n- **epub** - `application/epub+zip`\n- **zip** - `application/zip`\n- **tar** - `application/x-tar`\n- **rar** - `application/x-rar-compressed`\n- **gz** - `application/gzip`\n- **bz2** - `application/x-bzip2`\n- **7z** - `application/x-7z-compressed`\n- **xz** - `application/x-xz`\n- **pdf** - `application/pdf`\n- **exe** - `application/x-msdownload`\n- **swf** - `application/x-shockwave-flash`\n- **rtf** - `application/rtf`\n- **eot** - `application/octet-stream`\n- **ps** - `application/postscript`\n- **sqlite** - `application/x-sqlite3`\n- **nes** - `application/x-nintendo-nes-rom`\n- **crx** - `application/x-google-chrome-extension`\n- **cab** - `application/vnd.ms-cab-compressed`\n- **deb** - `application/x-deb`\n- **ar** - `application/x-unix-archive`\n- **Z** - `application/x-compress`\n- **lz** - `application/x-lzip`\n\n#### Font\n\n- **woff** - `application/font-woff`\n- **woff2** - `application/font-woff`\n- **ttf** - `application/font-sfnt`\n- **otf** - `application/font-sfnt`\n\n\n\nLicense\n-------\n\nMIT - Geoff Mureithi\nLots of ideas borrowed Tomas Aparicio\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeofmureithi-zz%2Ffiletypes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeofmureithi-zz%2Ffiletypes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeofmureithi-zz%2Ffiletypes/lists"}