Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get file extension nodejs

const path = require('path');

path.extname('index.html');
// Returns: '.html'

path.extname('index.coffee.md');
// Returns: '.md'

path.extname('index.');
// Returns: '.'

path.extname('index');
// Returns: ''

path.extname('.index');
// Returns: ''

path.extname('.index.md');
// Returns: '.md'
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #file #extension #nodejs
ADD COMMENT
Topic
Name
1+5 =