Module ringo/buffer

A Buffer class for composing strings.

Class Buffer

Instance Methods

Instance Properties


Buffer (...)

A Buffer class for composing strings. This is implemented as a simple wrapper around a JavaScript array.

Parameters

... initial parts to write to the buffer

Buffer.prototype.digest (algorithm)

Get a message digest on the content of this buffer.

Parameters

algorithm the algorithm to use, defaults to MD5

Buffer.prototype.forEach (fn)

Call function fn with each content part in this buffer.

Parameters

fn a function to apply to each buffer part

Buffer.prototype.length

A read-only property containing the number of characters currently contained by this buffer.


Buffer.prototype.reset ()

Reset the buffer discarding all its content.

Returns

this buffer object

Buffer.prototype.toString ()

Return the content of this buffer as string.


Buffer.prototype.write (...)

Append all arguments to this buffer.

Parameters

... variable arguments to append to the buffer

Returns

this buffer object

Buffer.prototype.writeln (...)

Append all arguments to this buffer terminated by a carriage return/newline sequence.

Parameters

... variable arguments to append to the buffer

Returns

this buffer object