For example, assuming that x = filename.jpg, I want to get filename, where filename could be any file name (Let\'s assume the file nam
x = filename.jpg
filename
In node.js, the name of the file without the extension can be obtained as follows.
const path = require('path'); const filename = 'hello.html'; path.parse(filename).name; // hello path.parse(filename).ext; // .html
Further explanation at Node.js documentation page.