{"id":17241780,"url":"https://github.com/j256/simplemagic","last_synced_at":"2025-04-13T06:21:20.896Z","repository":{"id":8332861,"uuid":"9887174","full_name":"j256/simplemagic","owner":"j256","description":"Simple file magic number and content-type library which provides mime-type determination from files and byte arrays","archived":false,"fork":false,"pushed_at":"2023-12-05T22:09:43.000Z","size":5339,"stargazers_count":227,"open_issues_count":33,"forks_count":45,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-13T04:59:51.498Z","etag":null,"topics":["java","magic","mime","unix"],"latest_commit_sha":null,"homepage":"http://256stuff.com/sources/simplemagic/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/j256.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"j256","patreon":"j256"}},"created_at":"2013-05-06T13:18:01.000Z","updated_at":"2025-03-03T09:51:48.000Z","dependencies_parsed_at":"2024-10-30T00:23:30.467Z","dependency_job_id":null,"html_url":"https://github.com/j256/simplemagic","commit_stats":{"total_commits":366,"total_committers":10,"mean_commits":36.6,"dds":"0.10109289617486339","last_synced_commit":"fdd5e5b519ed60a2e4c83db13ae2ccdb0700e87f"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j256%2Fsimplemagic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j256%2Fsimplemagic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j256%2Fsimplemagic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j256%2Fsimplemagic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/j256","download_url":"https://codeload.github.com/j256/simplemagic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665756,"owners_count":21142123,"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":["java","magic","mime","unix"],"created_at":"2024-10-15T06:11:18.743Z","updated_at":"2025-04-13T06:21:20.857Z","avatar_url":"https://github.com/j256.png","language":"Java","readme":"Java Simple Magic\n=================\n\nHere's a \"magic\" number package  which allows content-type (mime-type) determination from files and byte arrays. It makes\nuse of the magic(5) Unix content-type files to implement the same functionality as the Unix file(1) command in Java which\ndetects the contents of a file. It uses either internal config files or can read ```/etc/magic```,\n```/usr/share/file/magic```, or other magic(5) files and determine file content from ```File```, ```InputStream```, or\n```byte[]```.\n\n* For more information, visit the [home page](http://256stuff.com/sources/simplemagic/).\n* The source code be found on the [git repository](https://github.com/j256/simplemagic).  [![CircleCI](https://circleci.com/gh/j256/simplemagic.svg?style=svg)](https://circleci.com/gh/j256/simplemagic) [![CodeCov](https://img.shields.io/codecov/c/github/j256/simplemagic.svg)](https://codecov.io/github/j256/simplemagic/)\n* Maven packages are published via [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.j256.simplemagic/simplemagic/badge.svg?style=flat-square)](https://maven-badges.herokuapp.com/maven-central/com.j256.simplemagic/simplemagic/) [![javadoc](https://javadoc.io/badge2/com.j256.simplemagic/simplemagic/javadoc.svg)](https://javadoc.io/doc/com.j256.simplemagic/simplemagic)\n\nEnjoy.  Gray Watson\n\n# Getting Started\n\nTo get started you use the SimpleMagic package like the following:\n```java\n// create a magic utility using the internal magic file\nContentInfoUtil util = new ContentInfoUtil();\n// if you want to use a different config file(s), you can load them by hand:\n// ContentInfoUtil util = new ContentInfoUtil(\"/etc/magic\");\n// ...\nContentInfo info = util.findMatch(\"/tmp/upload.tmp\");\n// or\nContentInfo info = util.findMatch(inputStream);\n// or\nContentInfo info = util.findMatch(contentByteArray);\n```\nOnce you have the [```ContentInfo```](https://github.com/j256/simplemagic/blob/master/src/main/java/com/j256/simplemagic/ContentInfo.java)\nit provides:\n \n* Enumerated type if the type is common\n* Approximate content-name\n* Full message produced by the magic file\n* Mime-type string if one configured by the config file\n* Associated file extensions (if any)\n\nFor example:\n\n* ```HTML, mime 'text/html', msg 'HTML document text'```\n* ```Java, msg 'Java serialization data, version 5'```\n* ```PDF, mime 'application/pdf', msg 'PDF document, version 1.4'```\n* ```gzip, mime 'application/x-gzip', msg 'gzip compressed data, was \"\", from Unix...'```\n* ```GIF, mime 'image/gif', msg 'GIF image data, version 89a, 16 x 16'```\n* ```PNG, mime 'image/png', msg 'PNG image, 600 x 371, 8-bit/color RGB, non-interlaced'```\n* ```ISO, mime 'audio/mp4', msg 'ISO Media, MPEG v4 system, iTunes AAC-LC'```\n* ```Microsoft, mime 'application/msword', msg 'Microsoft Word Document'```\n* ```RIFF, mime 'audio/x-wav', msg 'RIFF (little-endian) data, WAVE audio, Microsoft...'```\n* ```JPEG, mime 'image/jpeg', msg 'JPEG image data, JFIF standard 1.01'```\n\n# Maven Configuration\n\n* Maven packages are published via [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.j256.simplemagic/simplemagic/badge.svg?style=flat-square)](https://maven-badges.herokuapp.com/maven-central/com.j256.simplemagic/simplemagic/)\n\n``` xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003ecom.j256.simplemagic\u003c/groupId\u003e\n\t\u003cartifactId\u003esimplemagic\u003c/artifactId\u003e\n\t\u003cversion\u003e1.17\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n# ChangeLog Release Notes\n\nSee the [ChangeLog.txt file](src/main/javadoc/doc-files/changelog.txt).\n","funding_links":["https://github.com/sponsors/j256","https://patreon.com/j256"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj256%2Fsimplemagic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj256%2Fsimplemagic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj256%2Fsimplemagic/lists"}