Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY CYBERSECURITY DATA SCIENCE
     ❯   

Node.js path.extname() Method

❮ Path Module


Example

Get the extension from a file path:

var path = require('path');

var ext = path.extname('/Users/Refsnes/demo_path.js');
console.log(ext);
Run example »

Definition and Usage

The path.extname() method returns the extension of a file path.


Syntax

path.extname(path);

Parameter Values

Parameter Description
path Required. The file path to search in

Technical Details

Return Value: The extension, as a String
Node.js Version: 0.1.25

❮ Path Module