All Projects → j256 → Simplemagic

j256 / Simplemagic

Licence: isc
Simple file magic number and content-type library which provides mime-type determination from files and byte arrays

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Simplemagic

ruby-magic
Simple interface to libmagic for Ruby Programming Language
Stars: ✭ 23 (-84.25%)
Mutual labels:  magic, mime
Oksh
Portable OpenBSD ksh, based on the Public Domain Korn Shell (pdksh).
Stars: ✭ 142 (-2.74%)
Mutual labels:  unix
Bash Utils
A collection of hand-crafted bash scripts for various common tasks.
Stars: ✭ 124 (-15.07%)
Mutual labels:  unix
Fluentftp
An FTP and FTPS client for .NET & .NET Standard, optimized for speed. Provides extensive FTP commands, File uploads/downloads, SSL/TLS connections, Automatic directory listing parsing, File hashing/checksums, File permissions/CHMOD, FTP proxies, FXP support, UTF-8 support, Async/await support, Powershell support and more. Written entirely in C#,…
Stars: ✭ 1,943 (+1230.82%)
Mutual labels:  unix
Unix V6
UNIX 6th Edition Kernel Source Code
Stars: ✭ 125 (-14.38%)
Mutual labels:  unix
Asciinema Player
asciinema player is an open-source terminal session player written in Javascript and Rust/WASM. Unlike other video players asciinema player doesn't play heavy-weight video files (.mp4, .webm etc) and instead plays light-weight terminal session files called asciicasts.
Stars: ✭ 1,948 (+1234.25%)
Mutual labels:  unix
Uftpd
FTP/TFTP server for Linux that just works™
Stars: ✭ 122 (-16.44%)
Mutual labels:  unix
Xmenu
a x11 menu utility
Stars: ✭ 145 (-0.68%)
Mutual labels:  unix
Smcroute
Static multicast routing for UNIX
Stars: ✭ 140 (-4.11%)
Mutual labels:  unix
Pipe operator
Elixir/Unix style pipe operations in Ruby - PROOF OF CONCEPT
Stars: ✭ 136 (-6.85%)
Mutual labels:  unix
Simple Mail
An SMTP library written in C++ for Qt. Allows applications to send emails (MIME with text, html, attachments, inline files, etc.) via SMTP. Supports SSL and SMTP authentication.
Stars: ✭ 134 (-8.22%)
Mutual labels:  mime
Bewitchment
Mod inspired by Witchery
Stars: ✭ 128 (-12.33%)
Mutual labels:  magic
Nami
A decentralized binary package manager.
Stars: ✭ 141 (-3.42%)
Mutual labels:  unix
Cats
Implementations of cat(1) from various sources.
Stars: ✭ 125 (-14.38%)
Mutual labels:  unix
Pimd
PIM-SM/SSM multicast routing for UNIX
Stars: ✭ 143 (-2.05%)
Mutual labels:  unix
Python And Oop
Object-Oriented Programming concepts in Python
Stars: ✭ 123 (-15.75%)
Mutual labels:  magic
Adams
UNIX system administration in Common Lisp
Stars: ✭ 135 (-7.53%)
Mutual labels:  unix
I3wm Themer
🎨 Theme collection manager for i3-wm
Stars: ✭ 1,854 (+1169.86%)
Mutual labels:  unix
Magicallife
A 2d game that aspires to be similar to Rimworld, with more depth, magic, and RPG concepts.
Stars: ✭ 145 (-0.68%)
Mutual labels:  magic
Sqrape
Simple Query Scraping with CSS and Go Reflection (MOVED to Gitlab)
Stars: ✭ 144 (-1.37%)
Mutual labels:  magic

Java Simple Magic

Here's a "magic" number package which allows content-type (mime-type) determination from files and byte arrays. It makes use of the magic(5) Unix content-type files to implement the same functionality as the Unix file(1) command in Java which detects the contents of a file. It uses either internal config files or can read /etc/magic, /usr/share/file/magic, or other magic(5) files and determine file content from File, InputStream, or byte[].

  • For more information, visit the home page.
  • The source code be found on the git repository. CircleCI CodeCov
  • Maven packages are published via Maven Central javadoc

Enjoy, Gray Watson

Getting Started

To get started you use the SimpleMagic package like the following:

// create a magic utility using the internal magic file
ContentInfoUtil util = new ContentInfoUtil();
// if you want to use a different config file(s), you can load them by hand:
// ContentInfoUtil util = new ContentInfoUtil("/etc/magic");
// ...
ContentInfo info = util.findMatch("/tmp/upload.tmp");
// or
ContentInfo info = util.findMatch(inputStream);
// or
ContentInfo info = util.findMatch(contentByteArray);

Once you have the ContentInfo it provides:

  • Enumerated type if the type is common
  • Approximate content-name
  • Full message produced by the magic file
  • Mime-type string if one configured by the config file
  • Associated file extensions (if any)

For example:

  • HTML, mime 'text/html', msg 'HTML document text'
  • Java, msg 'Java serialization data, version 5'
  • PDF, mime 'application/pdf', msg 'PDF document, version 1.4'
  • gzip, mime 'application/x-gzip', msg 'gzip compressed data, was "", from Unix...'
  • GIF, mime 'image/gif', msg 'GIF image data, version 89a, 16 x 16'
  • PNG, mime 'image/png', msg 'PNG image, 600 x 371, 8-bit/color RGB, non-interlaced'
  • ISO, mime 'audio/mp4', msg 'ISO Media, MPEG v4 system, iTunes AAC-LC'
  • Microsoft, mime 'application/msword', msg 'Microsoft Word Document'
  • RIFF, mime 'audio/x-wav', msg 'RIFF (little-endian) data, WAVE audio, Microsoft...'
  • JPEG, mime 'image/jpeg', msg 'JPEG image data, JFIF standard 1.01'

ChangeLog Release Notes

See the ChangeLog.txt file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].