Socket
Socket
Sign inDemoInstall

file-type

Package Overview
Dependencies
11
Maintainers
1
Versions
142
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 18.2.0 to 18.2.1

27

core.js

@@ -614,13 +614,20 @@ import {Buffer} from 'node:buffer';

if (this.checkString('%PDF')) {
await tokenizer.ignore(1350);
const maxBufferSize = 10 * 1024 * 1024;
const buffer = Buffer.alloc(Math.min(maxBufferSize, tokenizer.fileInfo.size));
await tokenizer.readBuffer(buffer, {mayBeLess: true});
try {
await tokenizer.ignore(1350);
const maxBufferSize = 10 * 1024 * 1024;
const buffer = Buffer.alloc(Math.min(maxBufferSize, tokenizer.fileInfo.size));
await tokenizer.readBuffer(buffer, {mayBeLess: true});
// Check if this is an Adobe Illustrator file
if (buffer.includes(Buffer.from('AIPrivateData'))) {
return {
ext: 'ai',
mime: 'application/postscript',
};
// Check if this is an Adobe Illustrator file
if (buffer.includes(Buffer.from('AIPrivateData'))) {
return {
ext: 'ai',
mime: 'application/postscript',
};
}
} catch (error) {
// Swallow end of stream error if file is too small for the Adobe AI check
if (!(error instanceof strtok3.EndOfStreamError)) {
throw error;
}
}

@@ -627,0 +634,0 @@

{
"name": "file-type",
"version": "18.2.0",
"version": "18.2.1",
"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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc