The first thing you should do is determine the user/group combination that your node.js app is being run as.
node.js at runtime inherits the filesystem permissions of the user & group membership much like any process in linux/unix.
You can do that by examining the running processes with lsof
and ps
.
For short (shows the running user of your node app):
ps xaf | grep node | awk '{ system("lsof | grep " $1) }' | awk '{ print $3 }'
The second thing you should determine is if the file in question (i.e. /mount/fs/folder/newGroup.xml) has 'write/append' permissions which you are currently specifying as the fs.open()
mode.
You can determine the permissions of the file (which I am assuming is going to be a read only file share due to the mount point of /mount
indicating a possible read-only filesystem such as those on a DVD/CD drive) like so:
ls -lah /mount/fs/folder/newGroup.xml