file-type-lint

raw JSON →
4.0.0 verified Fri May 01 auth: no javascript maintenance

Lint file types based on content rather than extension. Works with images, audio, video, archives, and many other formats. The latest stable version is 4.0.0 (released May 2020), which uses file-type v14.3.0 internally and requires Node.js >= 10.13.0. Unlike simple extension checks, it reads the file's content to verify its actual type. Current release cadence is low, with no updates since 2020.

error Error: Cannot find module 'file-type-lint'
cause Package not installed or not in node_modules.
fix
Run npm install file-type-lint --save-dev
error TypeError: fileTypeLint is not a function
cause Using ES import syntax on a CJS module.
fix
Use require('file-type-lint') instead of import.
breaking Minimum Node.js version is now 10.13.0
fix Upgrade Node.js to 10.13.0 or later.
gotcha Package is CommonJS only; cannot import with ES import syntax.
fix Use require('file-type-lint') instead of import.
deprecated No active development; last release 2020
fix Consider using file-type directly or other modern alternatives.
npm install file-type-lint
yarn add file-type-lint
pnpm add file-type-lint

Shows the Node.js API usage to lint all files in the current directory by content type.

const fileTypeLint = require('file-type-lint');

fileTypeLint({ files: '**/*' })
  .then(result => {
    if (result.errored) {
      console.error('Errors found:', result.errors);
    } else {
      console.log('All files match their content types.');
    }
  })
  .catch(error => {
    console.error('Linting failed:', error);
  });