[Pas2js] [feature request + ideas] Implementing TStream based classes (TBytesStream, TFileStream, TStringStream and so on)

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Nov 10 08:38:55 CET 2018


On Sat, 10 Nov 2018 00:50:12 -0300
silvioprog <silvioprog at gmail.com> wrote:

>[...]
> > How do you propose to replace the methods ReadBuffer and
> > WriteBuffer? 

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?

And reading/writing for example a word is fast in Pascal. I guess it
will be a lot slower in JS.
NodeJS has streams. They support writing strings/buffer/uint8array and
strings support encoding. So the NodeJS implementation is easier than
the browser implementation.
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.

Mattias


More information about the Pas2js mailing list