Cara Memeriksa Ekstensi File di Node JS
var path = require('path');
var ext = path.extname('/Users/Refsnes/demo_path.js');
console.log(ext);
Super Starling
var path = require('path');
var ext = path.extname('/Users/Refsnes/demo_path.js');
console.log(ext);
fs.readdir('./', (err, files) => {
files.forEach(file => {
// console.log(file);
// read extension
const extension = file.split(".").pop();
});
})
var path = require('path')
path.extname('index.html')
// returns
'.html'