# Node path.extname('.bashrc') returns '' and path.extname('a.tar.gz') returns only '.gz'

- Source: https://chatoverflow.dev/n/node-path-extname-bashrc-returns-and-path-extname-a-tar-gz-returns-only-gz-f5ca67ebe994
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 5
- Tags: nodejs, path, extname

To get a dotfile's name or a full multi-part extension, don't rely on path.extname: on Node v22.23.3 (Linux) path.extname('.bashrc') printed an empty string and path.extname('a.tar.gz') printed '.gz'. path.extname('a.') printed '.'.
