Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

detect-file-type

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detect-file-type - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

files/fixture.svg

1

index.js

@@ -101,2 +101,3 @@ 'use strict';

isDetected = slicedHex === rule.bytes;
console.log(buffer.slice(rule.start || 0, rule.end || buffer.length).toString());
return _this3.isReturnFalse(isDetected, type);

@@ -103,0 +104,0 @@ }

2

package.json
{
"name": "detect-file-type",
"version": "0.0.9",
"version": "0.0.10",
"description": "Detect file type by signature",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -6,3 +6,3 @@ # detect-file-type

### Поддерживаемые типы (будет пополнятся)
jpg, png, gif, bmp, webp, tif, cr2, jxr, psd, zip, epub, xpi, tar, rar, gz, bz2, 7z, dmg, mp4, m4v, midi, mkv, webm, wmv, mpg, mov, avi, mp3, m4a, opus, ogg, flac, wav, amr, pdf, exe, swf, rtf, woff, woff2, eot, ttf, otf, ico, ps, flv, xz, sqlite, nes, crx, cab, deb, rpm, Z, lz, msi
jpg, png, gif, bmp, webp, tif, cr2, jxr, psd, zip, epub, xpi, tar, rar, gz, bz2, 7z, dmg, mp4, m4v, midi, mkv, webm, wmv, mpg, mov, avi, mp3, m4a, opus, ogg, flac, wav, amr, pdf, exe, swf, rtf, woff, woff2, eot, ttf, otf, ico, ps, flv, xz, sqlite, nes, crx, cab, deb, rpm, Z, lz, msi, svg

@@ -9,0 +9,0 @@ ## Usage

@@ -6,3 +6,3 @@ # detect-file-type [![Build Status](https://travis-ci.org/dimapaloskin/detect-file-type.svg?branch=master)](https://travis-ci.org/dimapaloskin/detect-file-type)

### Supported types (will be updated)
jpg, png, gif, bmp, webp, tif, cr2, jxr, psd, zip, epub, xpi, tar, rar, gz, bz2, 7z, dmg, mp4, m4v, midi, mkv, webm, wmv, mpg, mov, avi, mp3, m4a, opus, ogg, flac, wav, amr, pdf, exe, swf, rtf, woff, woff2, eot, ttf, otf, ico, ps, flv, xz, sqlite, nes, crx, cab, deb, rpm, Z, lz, msi
jpg, png, gif, bmp, webp, tif, cr2, jxr, psd, zip, epub, xpi, tar, rar, gz, bz2, 7z, dmg, mp4, m4v, midi, mkv, webm, wmv, mpg, mov, avi, mp3, m4a, opus, ogg, flac, wav, amr, pdf, exe, swf, rtf, woff, woff2, eot, ttf, otf, ico, ps, flv, xz, sqlite, nes, crx, cab, deb, rpm, Z, lz, msi, svg

@@ -9,0 +9,0 @@ ## Installation

@@ -645,3 +645,12 @@ [

]
},
{
"type": "svg",
"ext": "svg",
"mime": "image/svg+xml",
"rules": [
{ "type": "contains", "bytes": "3c737667" }
]
}
]

@@ -644,2 +644,13 @@ import {assert} from 'chai';

it('should detect svg', (done) => {
detect.fromFile('./files/fixture.svg', (err, result) => {
assert.equal(err, null);
assert.deepEqual(result, {
ext: 'svg',
mime: 'image/svg+xml'
});
done();
});
});
});

@@ -650,2 +650,24 @@ 'use strict';

});
it('should detect svg', function (done) {
_index2.default.fromFile('./files/fixture.svg', function (err, result) {
_chai.assert.equal(err, null);
_chai.assert.deepEqual(result, {
ext: 'svg',
mime: 'image/svg+xml'
});
done();
});
});
it('should detect doc', function (done) {
_index2.default.fromFile('./files/fixture.doc', function (err, result) {
_chai.assert.equal(err, null);
_chai.assert.deepEqual(result, {
ext: 'doc',
mime: 'application/msword'
});
done();
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc