<div dir="ltr">I consulted this wiki and File is not implemented for v8, only FileIo is available.<br><br>I ended up doing something similar,<br><div>var read_size = 2048;</div><div>do {</div><div> read_size *=2;</div><div> var jsFd = new FileIO('/opt/prj_jsons/cfId.json', 'r');</div><div> jsFd.read(read_size);</div><div> jsData = jsFd.data();</div><div> jsFd.close();<br></div><div>}while(jsData.length == read_size);</div><div><br>its a good idea to put a cap on the read_size, i'll put a cap on after a few Mbs. <br>I tried appending the new data to the incomplete read attempt, but after the first iteration the buffer wont clear and on last iteration data from previous read attempt was concatenated to the .data() output of the last read attempt after the data in file finished. <br><br>if the data read cannot exceed the total bytes in the file I can get rid of this and safely just put the desired cap size in the read_size. Thanks.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 24, 2017 at 1:00 AM, Anthony Minessale <span dir="ltr"><<a href="mailto:anthony.minessale@gmail.com" target="_blank">anthony.minessale@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">That wiki documentation is from the old spidermonkey js module not the new v8 one.<div><br></div><div>I believe that putting a very large number will not cause any problems as the data read cannot exceed the total bytes in the file so it should not be a problem.</div><div>You can always do an append loop. Its usually a good practice to have a precise max size to read because what if the file was accidentally 2gb.</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Fri, Jun 23, 2017 at 3:36 AM, Raymond <span dir="ltr"><<a href="mailto:xxxman2008@126.com" target="_blank">xxxman2008@126.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hi ,</div><div><br></div><div> This will help you . <a href="https://wiki.freeswitch.org/wiki/File" target="_blank">https://wiki.freeswitch.org<wbr>/wiki/File</a><span class="m_-1661914744863535854HOEnZb"><font color="#888888"> </font></span></div><span class="m_-1661914744863535854HOEnZb"><font color="#888888"><div> </div><div style="zoom:1"></div><div id="m_-1661914744863535854m_-1722616414546404880divNeteaseMailCard"></div><div>Raymond</div></font></span><div><div class="m_-1661914744863535854h5"><div><br></div>At 2017-06-22 21:49:33, "Faruq Ahmad" <<a href="mailto:afarooqa@gmail.com" target="_blank">afarooqa@gmail.com</a>> wrote:<br> <blockquote id="m_-1661914744863535854m_-1722616414546404880isReplyContent" style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid"><div dir="ltr">Hi,<br><br>I have a FS dialplan that fetches callflow from a JSON file. File is read using <br><br>var JsonFd = new FileIO(JsonPath, 'r');<br><div>JsonFd.read(2048);</div><div><div>result = JsonFd.data();</div></div><div><div>var menu = JSON.parse(result),</div></div><div><br>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. <br><br>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?<br>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?</div></div>
</blockquote></div></div></div><br><br><span title="neteasefooter"><p> </p></span><br></div></div>______________________________<wbr>______________________________<wbr>_____________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions<wbr>.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.o<wbr>rg</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswi<wbr>tch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/ma<wbr>ilman/listinfo/freeswitch-user<wbr>s</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.frees<wbr>witch.org/mailman/options/<wbr>freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><span class="HOEnZb"><font color="#888888"><br></font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_-1661914744863535854gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Anthony Minessale II ♬ @anthmfs ♬ @FreeSWITCH ♬<div><br><div>☞ <a href="http://freeswitch.org/" target="_blank">http://freeswitch.org/</a> ☞ <a href="http://cluecon.com/" target="_blank">http://cluecon.com/</a> ☞ <a href="http://twitter.com/FreeSWITCH" target="_blank">http://twitter.com/FreeSWITCH</a></div><div><div>☞ <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> #freeswitch ☞ <u><a href="http://freeswitch.org/g+" target="_blank">http://freeswitch.org/g+</a></u><br><br></div><div>ClueCon Weekly Development Call <br></div><div>☎ <a href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.<wbr>freeswitch.org</a> ☎ <a href="tel:(919)%20386-9900" value="+19193869900" target="_blank">+19193869900</a> </div><div><br></div></div></div><div><a href="https://www.youtube.com/watch?v=9XXgW34t40s" style="color:rgb(17,85,204);font-size:12.8000001907349px" target="_blank">https://www.youtube.com/watch?<wbr>v=9XXgW34t40s</a></div><div><a href="https://www.youtube.com/watch?v=NLaDpGQuZDA" target="_blank">https://www.youtube.com/watch?<wbr>v=NLaDpGQuZDA</a><br></div></div></div></div></div></div></div>
</font></span></div>
<br>______________________________<wbr>______________________________<wbr>_____________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.<wbr>freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.<wbr>org</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.<wbr>freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/<wbr>mailman/listinfo/freeswitch-<wbr>users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.<wbr>freeswitch.org/mailman/<wbr>options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br></div>