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.12 to 0.0.13

files/fixture-simple-html.html

2

index.js

@@ -7,3 +7,3 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

@@ -10,0 +10,0 @@ var _fs = require('fs');

{
"name": "detect-file-type",
"version": "0.0.12",
"version": "0.0.13",
"description": "Detect file type by signature",

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

@@ -103,2 +103,11 @@ [

{
"type": "flif",
"ext": "flif",
"mime": "image/flif",
"rules": [
{ "type": "equal", "start": 0, "end": 4, "bytes": "464c4946" }
]
},
{
"type": "zip",

@@ -655,3 +664,17 @@ "ext": "zip",

]
},
{
"type": "html",
"ext": "html",
"mime": "text/html",
"rules": [
{ "type": "or", "rules":
[
{ "type": "contains", "bytes": "3c68746d6c" },
{ "type": "contains", "bytes": "3c00680074006d006c00" }
]
}
]
}
]

@@ -655,2 +655,24 @@ import {assert} from 'chai';

it('should detect flif', (done) => {
detect.fromFile('./files/fixture.flif', (err, result) => {
assert.equal(err, null);
assert.deepEqual(result, {
ext: 'flif',
mime: 'image/flif'
});
done();
});
});
it('should detect html started with html tag', (done) => {
detect.fromFile('./files/fixture-simple-html.html', (err, result) => {
assert.equal(err, null);
assert.deepEqual(result, {
ext: 'html',
mime: 'text/html'
});
done();
});
});
});

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

});
it('should detect flif', function (done) {
_index2.default.fromFile('./files/fixture.flif', function (err, result) {
_chai.assert.equal(err, null);
_chai.assert.deepEqual(result, {
ext: 'flif',
mime: 'image/flif'
});
done();
});
});
it('should detect html started with html tag', function (done) {
_index2.default.fromFile('./files/fixture-simple-html.html', function (err, result) {
_chai.assert.equal(err, null);
_chai.assert.deepEqual(result, {
ext: 'html',
mime: 'text/html'
});
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