Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Stream.readlnBoundary (work-around for no unbounded memory stream)
// Example use:
var header_line = this.readlnBoundary( '\u000d\u000a' );
system.tmpfile = function() {
var d = new Date();
var r = String(Math.random()).replace(/\./,'');;
var n = '/tmp/tmp-' + r + '-' + d.valueOf();
var s = new Stream( n, 'w+' );
return s;
}
Stream.prototype.readBinBoundary = function( boundary ) {
var tmp_file = system.tmpfile();
var tmp_name = tmp_file.name;
this.readUntilBytes( boundary, tmp_file );
tmp_file.close();
return (tmp_name);
}
Stream.prototype.readlnBoundary = function( boundary ) {
var tmp_name = this.readBinBoundary( boundary );
var ln_stream = new Stream( tmp_name );
var ln_text = ln_stream.readFile();
ln_stream.close();
system.remove( tmp_name );
return ln_text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.