which-fileextension
v1.0.0
Published
detect file extensions, check if text or binary file, or get list of text or binary file extensions
Downloads
50
Maintainers
Keywords
Readme
which-fileextension
detect if a file extension is text/ binary or file is text/ binary
- detect file extensions
- check your file extension using provided string or array
- check if file is part of list of extension
- detect file extension is text
- detect file extension is binary
- detect if file is text
- detect if file is binary
USAGE
detect
, isExtension
, isTextExtension
, isBinaryExtension
,
const dr = require("which-fileextension");
dr.detect("test/tester.jpg", dr.binaryExtensions) // true
dr.detect("test/tester.jpg", dr.textExtensions) // false
dr.detect("test/tester.jpg", ["gz", "txt", "jpg", "jpeg"]) // true`
dr.isExtension("test/tester.jpg", "jpg") // true
dr.isExtension("test/tester.jpg", "txt") // false
dr.isTextExtension("test/tester.txt") // true
dr.isTextExtension("test/tester.jpeg") // false
dr.isBinaryExtension("test/tester.jpeg") // true
isText
, isBinary
const dr = require("which-fileextension");
dr.isText("test/tester.txt") // true
dr.isBinary("test/tester.exe") // true
binaryExtensions
, textExtensions
const dr = require("which-fileextension");
console.log(dr.textExtensions);
console.log(dr.binaryExtensions);
dr.detect("test/tester.jpg", dr.binaryExtensions) // true
dr.detect("test/tester.jpg", dr.textExtensions) // false