Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

file-type

Package Overview
Dependencies
Maintainers
2
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-type - npm Package Compare versions

Comparing version 12.0.1 to 12.1.0

7

index.js

@@ -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",

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