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 14.7.0 to 14.7.1

21

core.js

@@ -7,4 +7,3 @@ 'use strict';

tarHeaderChecksumMatches,
uint32SyncSafeToken,
uint8ArrayUtf8ByteString
uint32SyncSafeToken
} = require('./util');

@@ -468,3 +467,3 @@ const supported = require('./supported');

// For some cases, we're specific, everything else falls to `video/mp4` with `mp4` extension.
const brandMajor = uint8ArrayUtf8ByteString(buffer, 8, 12).replace('\0', ' ').trim();
const brandMajor = buffer.toString('binary', 8, 12).replace('\0', ' ').trim();
switch (brandMajor) {

@@ -1218,12 +1217,2 @@ case 'avif':

if (
check([0x30, 0x30, 0x30, 0x30, 0x30, 0x30], {offset: 148, mask: [0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8]}) && // Valid tar checksum
tarHeaderChecksumMatches(buffer)
) {
return {
ext: 'tar',
mime: 'application/x-tar'
};
}
if (check([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E])) {

@@ -1309,6 +1298,4 @@ return {

if (
check([0x30, 0x30, 0x30, 0x30, 0x30, 0x30], {offset: 148, mask: [0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8]}) && // Valid tar checksum
tarHeaderChecksumMatches(buffer)
) {
// Requires a buffer size of 512 bytes
if (tarHeaderChecksumMatches(buffer)) {
return {

@@ -1315,0 +1302,0 @@ ext: 'tar',

2

package.json
{
"name": "file-type",
"version": "14.7.0",
"version": "14.7.1",
"description": "Detect the file type of a Buffer/Uint8Array/ArrayBuffer",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -5,6 +5,2 @@ 'use strict';

const uint8ArrayUtf8ByteString = (array, start, end) => {
return String.fromCharCode(...array.slice(start, end));
};
exports.tarHeaderChecksumMatches = buffer => { // Does not check if checksum field characters are valid

@@ -15,5 +11,10 @@ if (buffer.length < 512) { // `tar` header size, cannot compute checksum without it

const readSum = parseInt(buffer.toString('utf8', 148, 154).replace(/\0.*$/, '').trim(), 8); // Read sum in header
if (isNaN(readSum)) {
return false;
}
const MASK_8TH_BIT = 0x80;
let sum = 256; // Intitalize sum, with 256 as sum of 8 spaces in checksum field
let sum = 256; // Initialize sum, with 256 as sum of 8 spaces in checksum field
let signedBitSum = 0; // Initialize signed bit sum

@@ -35,4 +36,2 @@

const readSum = parseInt(uint8ArrayUtf8ByteString(buffer, 148, 154), 8); // Read sum in header
// Some implementations compute checksum incorrectly using signed bytes

@@ -48,4 +47,2 @@ return (

exports.uint8ArrayUtf8ByteString = uint8ArrayUtf8ByteString;
/**

@@ -52,0 +49,0 @@ ID3 UINT32 sync-safe tokenizer token.

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