<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi.</div><div dir="ltr"><br></div><div dir="ltr">Firstly, thanks a lot Michael and Mattias for this incredible project! I'm using jQuery for years, but I'm surprised with the possibilities using this awesome transpiler to map my Pascal classes into JS/jQuery scripts.</div><div dir="ltr"><div><br></div><div>So, I would appreciate to contribute by sending the classes for streaming (maybe starting from TByteStream), but I would like to understand if there is a reason for it is not implemented yet. I suspect it was for reasons like client side vs browsers security.</div><div><br></div><div>I have some ideias to implement these classes, but it need to know if you agree with them:</div><div><br></div><div>For browser based scripts:</div><div><br></div><div>- classes which just handles buffers (TBytesStream, TStringStream) should be implemented using the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" target="_blank">ArrayBuffer object</a>;</div><div><br></div><div>- classes which handles files (TFileStream, TBytesStream*) should be implemented using the <a href="https://www.w3.org/TR/FileAPI/" target="_blank">File API</a>.</div><div><br></div><div>(throwing an error if the browser doesn't support the ArrayBuffer object/File API)</div><div><br></div><div>* It would use the TFileStream handle to save (into a file on the user drive) the buffer by the SaveToFile() method.<br></div><div><br></div><div>For security reasons the browser doesn't allows to save files in the user drive via client-side, but overriding the File API you can do it via something like 'window.URL.createObjectURL' (nice for the SaveToFile() method), that is allowed in many browsers. Another option would be 'window.requestFileSystem || window.webkitRequestFileSystem', enabled via some transpiler parameter.</div><div><br></div><div>For NodeJS based scripts:<br></div><div><br></div><div>- classes that just handle buffers should be implemented using the <a href="https://nodejs.org/api/buffer.html" target="_blank">Buffer()</a> (or something like this);</div><div><br></div><div><div>- classes that handle files should be implemented using the <a href="https://nodejs.org/api/fs.html" target="_blank">File System</a>.</div></div><div><br></div><div>What do you think?<br></div><div><div><br></div><div>I have some drafts in pure JS, but I think it can be easily adapted to Pascal code via asm-blocks.</div></div><div><br></div><div>Thank you!</div><div><br></div>--<br><div dir="ltr" class="gmail-m_-8971656412688272071gmail-m_818870390064096629gmail_signature"><div dir="ltr"><div>Silvio Clécio</div></div></div></div></div></div></div></div></div></div>