Gathering detailed insights and metrics for @picturae/mmmagic
Gathering detailed insights and metrics for @picturae/mmmagic
An async libmagic binding for node.js for detecting content types by data inspection
npm install @picturae/mmmagic
Typescript
Module System
Min. Node Version
Node Version
NPM Version
C++ (67.93%)
JavaScript (27.99%)
Python (4.08%)
Total Downloads
83,706
Last Day
720
Last Week
2,139
Last Month
7,801
Last Year
83,336
182 Commits
2 Forks
4 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
0.5.5
Package Id
@picturae/mmmagic@0.5.5
Unpacked Size
5.70 MB
Size
486.61 kB
File Count
81
NPM Version
10.8.1
Node Version
22.3.0
Publised On
21 Jun 2024
Cumulative downloads
Total Downloads
Last day
89%
720
Compared to previous day
Last week
-25.7%
2,139
Compared to previous week
Last month
-13.1%
7,801
Compared to previous month
Last year
22,423.2%
83,336
Compared to previous year
1
An async libmagic binding for node.js for detecting content types by data inspection.
npm install mmmagic
1 var Magic = require('mmmagic').Magic; 2 3 var magic = new Magic(); 4 magic.detectFile('node_modules/mmmagic/build/Release/magic.node', function(err, result) { 5 if (err) throw err; 6 console.log(result); 7 // output on Windows with 32-bit node: 8 // PE32 executable (DLL) (GUI) Intel 80386, for MS Windows 9 });
1 var mmm = require('mmmagic'), 2 Magic = mmm.Magic; 3 4 var magic = new Magic(mmm.MAGIC_MIME_TYPE); 5 magic.detectFile('node_modules/mmmagic/build/Release/magic.node', function(err, result) { 6 if (err) throw err; 7 console.log(result); 8 // output on Windows with 32-bit node: 9 // application/x-dosexec 10 });
1 var mmm = require('mmmagic'), 2 Magic = mmm.Magic; 3 4 var magic = new Magic(mmm.MAGIC_MIME_TYPE | mmm.MAGIC_MIME_ENCODING); 5 // the above flags can also be shortened down to just: mmm.MAGIC_MIME 6 magic.detectFile('node_modules/mmmagic/build/Release/magic.node', function(err, result) { 7 if (err) throw err; 8 console.log(result); 9 // output on Windows with 32-bit node: 10 // application/x-dosexec; charset=binary 11 });
1 var Magic = require('mmmagic').Magic; 2 3 var magic = new Magic(), 4 buf = new Buffer('import Options\nfrom os import unlink, symlink'); 5 6 magic.detect(buf, function(err, result) { 7 if (err) throw err; 8 console.log(result); 9 // output: Python script, ASCII text executable 10 });
(constructor)([< mixed >magicSource][, < Integer >flags]) - Creates and returns a new Magic instance. magicSource
(if specified) can either be a path string that points to a (compatible) magic file to use or it can be a Buffer containing the contents of a (compatible) magic file. If magicSource
is not a string and not false
, the bundled magic file will be used. If magicSource
is false
, mmmagic will default to searching for a magic file to use (order of magic file searching: MAGIC
env var -> various file system paths (see man file
)). flags is a bitmask with the following valid values (available as constants on require('mmmagic')
):
detectFile(< String >path, < Function >callback) - (void) - Inspects the file pointed at by path. The callback receives two arguments: an < Error > object in case of error (null otherwise), and a < String > containing the result of the inspection.
detect(< Buffer >data, < Function >callback) - (void) - Inspects the contents of data. The callback receives two arguments: an < Error > object in case of error (null otherwise), and a < String > containing the result of the inspection.
No vulnerabilities found.
No security vulnerabilities found.