We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 74820c4 + de6b891 commit 307b4f6Copy full SHA for 307b4f6
LICENSE
@@ -1,6 +1,6 @@
1
The MIT License (MIT)
2
3
-Copyright (c) 2016 Close.io
+Copyright (c) 2018 Close.io
4
5
Permission is hereby granted, free of charge, to any person obtaining a copy
6
of this software and associated documentation files (the "Software"), to deal
README.md
@@ -18,7 +18,7 @@ function(filevalidator) {
18
19
fileInput.addEventListener('change', function(e) {
20
var file = e.currentTarget.files[0];
21
- FileDetector.verifyFileType(file, ['mp3', 'wav'], function(valid) {
+ filevalidator.verifyFileType(file, ['mp3', 'wav'], function(valid) {
22
alert('Valid mp3 or wave file: ' + !!valid);
23
});
24
filevalidator.js
@@ -11,7 +11,15 @@ function(_) {
11
// MPEG-1 Layer 3 file without an ID3 tag or with an ID3v1 tag (which's appended at the end of the file)
12
[0xFF, 0xFB],
13
// MP3 file with an ID3v2 container
14
- [0x49, 0x44, 0x33]
+ [0x49, 0x44, 0x33],
15
+ // Other MP3 files (FF Fx and FF Ex – they may cause false-positives)
16
+ // Headers taken from https://www.garykessler.net/library/file_sigs.html
17
+ [0xFF, 0xE0], [0xFF, 0xE1], [0xFF, 0xE2], [0xFF, 0xE3], [0xFF, 0xE4],
+ [0xFF, 0xE5], [0xFF, 0xE6], [0xFF, 0xE7], [0xFF, 0xE8], [0xFF, 0xE9],
+ [0xFF, 0xEA], [0xFF, 0xEB], [0xFF, 0xEC], [0xFF, 0xED], [0xFF, 0xEE], [0xFF, 0xEF],
+ [0xFF, 0xF0], [0xFF, 0xF1], [0xFF, 0xF2], [0xFF, 0xF3], [0xFF, 0xF4],
+ [0xFF, 0xF5], [0xFF, 0xF6], [0xFF, 0xF7], [0xFF, 0xF8], [0xFF, 0xF9],
+ [0xFF, 0xFA], [0xFF, 0xFB], [0xFF, 0xFC], [0xFF, 0xFD], [0xFF, 0xFE], [0xFF, 0xFF]
],
'wav': [
25
// Waveform Audio File Format
package.json
@@ -1,11 +1,8 @@
{
"name": "filevalidator",
- "version": "1.0.0",
+ "version": "1.0.1",
"description": "File signature validation in JavaScript",
"main": "filevalidator.js",
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
"author": "Phil Freo <phil@philfreo.com> (http://philfreo.com/)",
10
"license": "MIT"
}
0 commit comments