🚀 Launch Week Day 4:Introducing the Alert Details Page: A Better Way to Explore Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

@file-type/pdf

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package version was removed
This package version has been unpublished, mostly likely due to security reasons

@file-type/pdf

file-type plugin to parse PDF files

unpublished
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

NPM version Node.js CI npm downloads

@file-type/pdf

Detector plugin for file-type that identifies PDF (Portable Document Format) files and selected PDF-based subtypes.

This plugin goes beyond simple magic-number detection and can inspect the internal PDF structure to distinguish between generic PDF files and specific producer formats such as Adobe Illustrator (.ai).

The detector is designed to be:

  • tokenizer-based (using strtok3)
  • streaming-friendly
  • safe to chain with other file-type detectors
  • compatible with both Node.js and browser environments

Installation

npm install @file-type/pdf

Usage

The following example shows how to add the PDF detector to file-type:

import { FileTypeParser } from 'file-type';
import { detectPdf } from '@file-type/pdf';

const parser = new FileTypeParser({
  customDetectors: [detectPdf],
});

const fileType = await parser.fromFile('example.pdf');
console.log(fileType);

Supported file formats

  • .ai / application/illustrator: Adobe Illustrator
  • .pdf / application/pdf: Generic Portable Document Format files

License

This project is licensed under the MIT License. Feel free to use, modify, and distribute it as needed.

Keywords

file-type

FAQs

Package last updated on 28 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts