file-type
Advanced tools
Comparing version 12.0.1 to 12.1.0
@@ -13,3 +13,3 @@ 'use strict'; | ||
const buffer = input instanceof Uint8Array ? input : new Uint8Array(input); | ||
const buffer = Buffer.from(input); | ||
@@ -195,3 +195,4 @@ if (!(buffer && buffer.length > 1)) { | ||
// Need to be before the `zip` check | ||
if (check([0x50, 0x4B, 0x3, 0x4])) { | ||
const zipHeader = Buffer.from([0x50, 0x4B, 0x3, 0x4]); | ||
if (check(zipHeader)) { | ||
if ( | ||
@@ -241,3 +242,3 @@ check([0x6D, 0x69, 0x6D, 0x65, 0x74, 0x79, 0x70, 0x65, 0x61, 0x70, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2F, 0x65, 0x70, 0x75, 0x62, 0x2B, 0x7A, 0x69, 0x70], {offset: 30}) | ||
// MS Office, OpenOffice and LibreOffice may put the parts in different order, so the check should not rely on it. | ||
const findNextZipHeaderIndex = (arr, startAt = 0) => arr.findIndex((el, i, arr) => i >= startAt && arr[i] === 0x50 && arr[i + 1] === 0x4B && arr[i + 2] === 0x3 && arr[i + 3] === 0x4); | ||
const findNextZipHeaderIndex = (buffer, startAt = 0) => buffer.indexOf(zipHeader, startAt); | ||
@@ -244,0 +245,0 @@ let zipHeaderIndex = 0; // The first zip header was already found at index 0 |
{ | ||
"name": "file-type", | ||
"version": "12.0.1", | ||
"version": "12.1.0", | ||
"description": "Detect the file type of a Buffer/Uint8Array/ArrayBuffer", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
1130
42976