[Jslib] Re: read() and readline()
Eric Plaster
plaster@visi.com
Thu, 17 Jan 2002 11:12:31 -0600
basic wrote:
> What do people think about extending read() to take a parameter to
> read the number of bytes instead of the whole file?
Easily done.
>
> And maybe readline could support DOS/Windows newlines by using
> split(/(?:\n\r)|[\n\r]/) rather than split(/[\n\r]/) ? ;-p
There are other operating systems other then linux? :) J/K
That would be a good thing to get in.
>
> currently read and readline uses rv variable for return values. This
> is okay for small chunks of data but when the return value is huge, it
> gets copied lots of times, since js doesn't do string reference. I
> guess it will get copied anyways, but using rv causes it to get copied
> one more time.
Ya, I'm surprised I did that. I'm usually pretty good at optimization.
Anyway, another good idea.
>
> I'm also wondering about have a read() method that returns an object
> with a property that contains the data string, this way it doesn't get
> copied as it returns a reference to the object. Not sure if that
> helps....
If you can send us a patch, or if you have access to the cvs, your
changes would be welcome. If you can't do it, I'll try and find some
time, but like peter said, I haven't had much time lately. But, with
the holidays over, and my basement nearly finished (I've been finishing
off my basement), I can see the light at the end of the tunnel.
>
> Is there a lib to load files via uri? like via ftp: http: file: ;-)
>
> basic
--
Eric Plaster
Urban Rage Software <http://www.urbanrage.com>
Senior Software Engineer
RPG tools project
rpgtools@urbanrage.com
http://rpgtools.mozdev.org
*/ AD&D tools for the player and the DM/*