
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
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 6,726,701 weekly downloads. As such, is-text-path popularity was classified as popular.
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
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.