Ross ROSS = Recommend OSS · open-source software intelligence for agents

sindresorhus/file-type

Detect the file type of a file, stream, or data observed · 2026-08-28

github.com/sindresorhus/file-type · JavaScript · MIT (permissive) observed · 2026-08-28

Health v2 · maintenance only

98/100

  • Activity 97
  • Release rhythm 98
  • Longevity 100
How is this computed?

round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.

  • gap_med: 14
  • age_days: 4514
  • days_rel: 19
  • days_push: 19
  • n_releases_24m: 22

Full methodology

Adoption not part of the score

4321 stars · 394 forks observed · 2026-08-28

What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-29, confidence not recorded

A Node.js/JavaScript library that detects the file type of a file, stream, or buffer by checking its magic number (binary signature). It returns the detected extension and MIME type for binary-based file formats.

Use cases

  • detect file type from uploaded file in nodejs
  • get mime type from a buffer or uint8array
  • identify file extension from a stream
  • validate uploaded file type by magic numbers
  • detect image or video format from file header bytes
  • sniff file type of a fetched remote resource

When to choose

  • you need to detect binary file formats in Node.js from files, streams, or buffers
  • you want a lightweight, well-maintained ESM package for MIME/extension sniffing
  • you need to validate uploads by their actual binary signature rather than filename

When to avoid

  • you need to detect text-based formats like .txt, .csv, or .svg
  • you need guaranteed validation that a file is well-formed and not malformed
  • your project is CommonJS-only and cannot consume ESM packages

Facets

library · maturity stable

parser developer-tools file-system developer-tools files web-development magic-numbers file-type-detection mime-type uint8array esm nodejs javascript

1 source

Member repositories

RepositoryRoleHealth v2
sindresorhus/file-typemain98

For agents

markdown · JSON · MCP: product_card(name="sindresorhus/file-type")

Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem