detect-file-type
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -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 @@ } |
{ | ||
"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(); | ||
}); | ||
}); | ||
}); |
22
test.js
@@ -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(); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2238
11596293