Sam Thorogood Sam is a former Googler, now CTO of the Australian energy startup Gridcognition, with an interest in all things web.

Stories by Sam Thorogood

Alternatives To __Dirname In Node

Alternatives to __dirname in Node.js with ES modules


Bring Node inline with ESM using the __dirname and __filename variables that allow you to import source files outside of your code.

Sam Thorogood
Mar 1, 2022 ⋅ 5 min read