expandUser.js python os.path.expanduser equivalent in nodejs Install npm i https://github.com/loynoir/expandUser.js Example const expandUser = require('expandUser'); console.log(expandUser('~/~/foo/bar/'));