[Freeswitch-users] writing to file in javascript
gigerlin
gilles.gerlinger at free.fr
Sat Mar 5 20:10:25 MSK 2011
Dear Freeswitch users,
I am developing some javascript applications that run within Freeswitch. I
can read without difficulty from files located on the same machine as
Freeswitch, but I can't write or create new files. The following code issues
an error when trying to open a file in "write mode".
var fd = new File("test.txt");
fd.open("write");
fd.write("Hello\n");
fd.close();
The error I got is:
2011-02-18 11:07:25.893733 [ERR] test.js:7 Error: File operation open
failed
I thought it was a sort of sandbox model issue. However I could generate a
file using the following system command:
session.execute("system", "echo Hello > test.txt");
The same error occurs when I tried to use the javascript function:
var tmp = fetchURLFile("http://myserver/test.html", "test.txt");
This creates an empty test.txt file.
I tried then to run the following system command:
session.execute("system", "wget -O test.txt http://myserver/test.html");
This as well creates an empty test.txt file. If I run "wget -O test.txt
http://myserver/test.html" directly from the system prompt this correctly
downloads and creates the test.txt file.
So my questions are: what did I miss? Is there some parameter to configure
that I haven't found?
Thank you in advance for your help,
Gilles Gerlinger
PS: Freeswitch is running over Ubuntu server 10.10
--
View this message in context: http://freeswitch-users.2379917.n2.nabble.com/writing-to-file-in-javascript-tp6092204p6092204.html
Sent from the freeswitch-users mailing list archive at Nabble.com.
More information about the FreeSWITCH-users
mailing list