
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
is-text-path
Advanced tools
The is-text-path npm package is a simple utility to check if a given file path points to a text file. It helps in determining whether a file is a text file based on its extension.
Check if a path is a text file
This feature allows you to check if a given file path points to a text file. The function returns true if the file is a text file based on its extension, otherwise false.
const isTextPath = require('is-text-path');
const filePath = 'example.txt';
const result = isTextPath(filePath);
console.log(result); // true
The is-binary-path package checks if a given file path points to a binary file. It is similar to is-text-path but focuses on binary files instead of text files.
The file-type package detects the file type of a Buffer or Uint8Array. It is more comprehensive than is-text-path as it can identify a wide range of file types, not just text files.
The mime package is used to look up the MIME type of a file based on its extension. It provides more detailed information about the file type compared to is-text-path, which only checks if a file is a text file.
Check if a file path is a text file
npm install is-text-path
import isTextPath from 'is-text-path';
isTextPath('source/unicorn.txt');
//=> true
isTextPath('source/unicorn.png');
//=> false
text-extensions
- List of text file extensionsis-binary-path
- Check if a file path is a binary fileFAQs
Check if a file path is a text file
The npm package is-text-path receives a total of 5,465,016 weekly downloads. As such, is-text-path popularity was classified as popular.
We found that is-text-path demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.