mirror of
https://github.com/codedread/bitjs
synced 2025-10-03 17:49:16 +02:00
Add TAR magic numbers to file sniffer.
This commit is contained in:
parent
8bf65d6384
commit
cd847d1b71
2 changed files with 7 additions and 0 deletions
|
@ -13,6 +13,11 @@
|
||||||
const fileSignatures = {
|
const fileSignatures = {
|
||||||
// Document formats.
|
// Document formats.
|
||||||
'application/pdf': [[0x25, 0x50, 0x44, 0x46, 0x2d]],
|
'application/pdf': [[0x25, 0x50, 0x44, 0x46, 0x2d]],
|
||||||
|
// Archive formats:
|
||||||
|
'application/x-tar': [
|
||||||
|
[0x75, 0x73, 0x74, 0x61, 0x72, 0x00, 0x30, 0x30],
|
||||||
|
[0x75, 0x73, 0x74, 0x61, 0x72, 0x20, 0x20, 0x00],
|
||||||
|
],
|
||||||
// Compressed archive formats.
|
// Compressed archive formats.
|
||||||
'application/x-7z-compressed': [[0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C]],
|
'application/x-7z-compressed': [[0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C]],
|
||||||
'application/x-bzip2': [[0x42, 0x5A, 0x68]],
|
'application/x-bzip2': [[0x42, 0x5A, 0x68]],
|
||||||
|
|
|
@ -34,4 +34,6 @@ describe('bitjs.file.sniffer', () => {
|
||||||
it('MP3_3()', () => { sniffTest('audio/mpeg', [0xFF, 0xF2]); });
|
it('MP3_3()', () => { sniffTest('audio/mpeg', [0xFF, 0xF2]); });
|
||||||
it('MP3_4()', () => { sniffTest('audio/mpeg', [0x49, 0x44, 0x33]); });
|
it('MP3_4()', () => { sniffTest('audio/mpeg', [0x49, 0x44, 0x33]); });
|
||||||
it('OGG', () => { sniffTest('application/ogg', [0x4F, 0x67, 0x67, 0x53]); });
|
it('OGG', () => { sniffTest('application/ogg', [0x4F, 0x67, 0x67, 0x53]); });
|
||||||
|
it('TAR_1', () => { sniffTest('application/x-tar', [0x75, 0x73, 0x74, 0x61, 0x72, 0x00, 0x30, 0x30]); });
|
||||||
|
it('TAR_2', () => { sniffTest('application/x-tar', [0x75, 0x73, 0x74, 0x61, 0x72, 0x20, 0x20, 0x00]); });
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue