angrilove / simplemagic Goto Github PK
View Code? Open in Web Editor NEWThis project forked from j256/simplemagic
Simple file magic number and content-type library.
License: Other
This project forked from j256/simplemagic
Simple file magic number and content-type library.
License: Other
This package provides some simple Java classes to read the magic files from Unix to simulate the file(1) command. For more information, visit the home page: http://256.com/sources/simplemagic/ The git repository is: https://github.com/j256/simplemagic Maven packages are published via the central repo: http://repo1.maven.org/maven2/com/j256/simplemagic/simplemagic/ Enjoy, Gray Watson ---------------------------------------------------------------------- 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 ContentDetails 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 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'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.