[Node.js] ファイルの拡張子を取得する path.extname
Node.js の path module を使って、下記のようにファイルの拡張子を取得することができます。
path.extname('index.html')
// returns
'.html'
path.extname('index.coffee.md')
// returns
'.md'
path.extname('index.')
// returns
'.'
path.extname('index')
// returns
''