[Freeswitch-users] Javascript FileIO

Faruq Ahmad afarooqa at gmail.com
Thu Jun 22 13:49:33 UTC 2017


I have a FS dialplan that fetches callflow from a JSON file. File is read

var JsonFd = new FileIO(JsonPath, 'r');
result = JsonFd.data();
var menu = JSON.parse(result),

Is there anyway I can read the whole file in one attempt, i.e. when a
smaller size was given to the .read() function it wouldn't read the
complete file. I have increased the value of size for read function however
my concern is in the long run file size might increase and parse would get
an incomplete JSON.

Is there anyway I can get filesize from FileIO object or detect EOF from
the read buffer to make sure the whole file is loaded?
Also if I increase the size for read fucntion buffer way over the estimated
filesizes, is there any guarantee that no garbage values will be read from
the disk after the EOF?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20170622/613988b7/attachment.html>

More information about the FreeSWITCH-users mailing list