Skip to content

Current tar file detection is unreliable #760

@Borewit

Description

@Borewit

Description

The current tar file detection does not detect every tar file archive.

Steps to reproduce:

Download https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.7.12.tar.gz

gunzip linux-6.7.12.tar.gz
import { fileTypeFromFile } from 'file-type'

const result = await fileTypeFromFile("linux-6.7.12.tar");
console.log(JSON.stringify(result));

Outputs

undefined

This issue seems to be related to some pax tar archives, where the first, and only the (few) first 512 tar blocks(s), do not seem to have a valid checksum set.

Existing Issue Check

  • I have searched the existing issues and could not find any related to my problem.

ESM (ECMAScript Module) Requirement Acknowledgment

  • My project is an ESM project and my package.json contains the following entry: "type": "module".

File-Type Scope Acknowledgment

  • I understand that file-type detects binary file types and not text or other formats.

Related:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions