First, Install the file-string-tools
, type in the terminal:
$ npm install file-string-tools
const FileTOOLS = require('file-string-tools');
const tool = new FileTOOLS();
console.log(tools.ext("hello.txt")) // .txt
console.log(tools.name("hello.txt")) // hello