I wanted to set a path to my user folder with "~/". Why is this not valid in javascript?
It has nothing to do with JavaScript. Node's file operations just don't expand ~ for you. It's not something that the file system automatically handles, it's something various programs (like your terminal, file manager, etc.) handle. You can get the home directory via os.homedir().
Tilde expansion is a bash feature that does not necessarily apply dependent on where the software is deployed. It also opens up questions about supporting other operators.
See https://github.com/nodejs/node/issues/684
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With