
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
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
We found that is-text-path demonstrated a not healthy version release cadence and project activity because the last version was released 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
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.