Acccess file system outside sandbox with node.js

Not applicable
in a previous question i found out where in the on prem file system a node.js app lived - but now i am trying to figure out if I can get r/w access outside of the immediate file system sandbox. For instance:
/opt/apigee4/var/log/apigee/message-processor/work/o/{org}/e/{environment}/a/{proxyname}_<ver>/node/organization/environment/api
Is where my code lives. Lets say I wanted to write something out to disk.. this is where it would show up. If i were to run a node module called "whereami.js" which output the full path it would output the following:
/organization/environment/api/whereami.js 
which seemingly identifies the bounds of the file systems andbox. But what if I wanted to write into /opt/otherfilelocation/ instead? Is this something that is possible?
Solved Solved
0 5 957
1 ACCEPTED SOLUTION

Not applicable

Node.js support in Edge was designed os that this sandbox is in place, so there is no way to read or write outside that virtual file system from inside the Node.js app. But if you're running Edge on-premises (not in our cloud) we'd have to enhance the product to allow you to enable the ability read and write to the "real" filesystem instead.

What's your use case for doing that?

View solution in original post

5 REPLIES 5

though it might be possible, i wouldn't recommend it. I had success reading files from the fs,but have not tried writes Especially, in a distributed environment like apigee, you might end up writing several chunks across your deployment. so, question back is what you want to write to file, its better you write to something that is again distribtued [maybe baas?] if its just for logging, you could still rely on console.log to write to system logs

in the specific case that im working on there wont be any unintended server switching between tasks. That i can be absolutely sure of.

Not applicable

Node.js support in Edge was designed os that this sandbox is in place, so there is no way to read or write outside that virtual file system from inside the Node.js app. But if you're running Edge on-premises (not in our cloud) we'd have to enhance the product to allow you to enable the ability read and write to the "real" filesystem instead.

What's your use case for doing that?

I am just trying to figure out if it is possible truth be told. I see that there is a line about it in the documentation as well (just saw it over the weekend but ive been gone!)

Hi @Greg Brail I know it's a bit old posting. But my use case is node saves a file from remote sftp server and do some converting task and send the file to another place. Would this be doable in the apigee? Thanks in advance.