[Pas2js] [feature request + ideas] Implementing TStream based classes (TBytesStream, TFileStream, TStringStream and so on)
silvioprog
silvioprog at gmail.com
Tue Nov 13 16:32:22 CET 2018
On Sat, Nov 10, 2018 at 4:39 AM Mattias Gaertner via Pas2js <
pas2js at lists.freepascal.org> wrote:
[...]
> You didn't answer my question. How to access the data in the stream?
> The big advantage of Pascal streams is the ability to easily read/write
> any datatype. This is not possible in JS.
> What kind of alternative overloads do you plan?
>
Please read the part "Indeed. But I have an idea which I would like to
check if you agree" in my second message. That was the only way I found to
make it to work for any data type.
NodeJS has streams. They support writing strings/buffer/uint8array and
> strings support encoding. So the NodeJS implementation is easier than
> the browser implementation.
>
I totally agree. But we should provide at least a way using
local/sessionstorage with the possibility to download it to a file (as
showed in my previous example).
I'm not sure if the JS unit already maps the browser storage interfaces,
but we can write it (if you agree the ideia I showed in the second message).
I started the nodejs external classes in unit nodejsfs. Feel free to
> complete the external classes. Note that nodejsfs is currently a mix
> up of streaming classes, filesystem class and Pascal RTL functions like
> FileExists. It is planned to distribute these parts to multiple units.
Awesome. I'll check this as soon as we find a solution for the browser side
(it think we are almost there ...).
--
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20181113/6ec2fecc/attachment.html>
More information about the Pas2js
mailing list