[Jslib] read() and readline()

basic _basic@yahoo.com
Thu, 17 Jan 2002 15:23:04 +0800


What do people think about extending read() to take a parameter to read the 
number of bytes instead of the whole file?

And maybe readline could support DOS/Windows newlines by using 
split(/(?:\n\r)|[\n\r]/) rather than split(/[\n\r]/) ? ;-p

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.

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....

Is there a lib to load files via uri? like via ftp: http: file: ;-)

basic