I have tried this code in meteor js but it will display error "TypeError: Object #Object> has no method 'parse'"
path = Npm.require('path')
filename = path.parse('/home/user/dir/file.txt')
The docs default to the current version of node, however meteor typically uses and older version. You can determine which version of node meteor is currently running by looking at the changelog. For v.1.0.3.2
it's node v0.10.33
. You can access the old docs here:
http://nodejs.org/docs/v0.10.33/api/
As you can see, the older version of path
did not have the parse
function. You can also see this via:
console.log(_.keys(path));
If you want to know what version you are using, this post will help you : How can I know the version of node being used by my meteor app?