Gathering detailed insights and metrics for @lexamica-modules/mmmagic
Gathering detailed insights and metrics for @lexamica-modules/mmmagic
Gathering detailed insights and metrics for @lexamica-modules/mmmagic
Gathering detailed insights and metrics for @lexamica-modules/mmmagic
npm install @lexamica-modules/mmmagic
Typescript
Module System
Min. Node Version
Node Version
NPM Version
Total Downloads
174
Last Day
1
Last Week
2
Last Month
12
Last Year
174
Minified
Minified + Gzipped
Latest Version
0.5.4
Package Id
@lexamica-modules/mmmagic@0.5.4
Unpacked Size
5.70 MB
Size
486.03 kB
File Count
82
NPM Version
10.5.0
Node Version
21.7.1
Publised On
18 Sept 2024
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-50%
2
Compared to previous week
Last month
140%
12
Compared to previous month
Last year
0%
174
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.