new BufferWriter()
Constructs a new buffer writer instance.
Extends
Members
- 
    
head { Object }
 - 
    
    
Operations head.
 - 
    
len { number }
 - 
    
    
Current length.
 - 
    
states { Object | null }
 - 
    
    
Linked forked states.
 - 
    
tail { Object }
 - 
    
    
Operations tail
 
Methods
- 
    
BufferWriter.alloc(size){ Buffer }
 - 
    
    
    
Allocates a buffer of the specified size.
Name Type Description sizenumber Buffer size
Returns:
Type Description Buffer Buffer  - 
    
    
    
Writes a boolish value as a varint.
Name Type Description valueboolean Value to write
Returns:
Type Description Writer this - 
    
    
    
Writes a sequence of bytes.
Name Type Description valueUint8Array | string Buffer or base64 encoded string to write
Returns:
Type Description Writer this - 
    
    
    
Writes a double (64 bit float).
Name Type Description valuenumber Value to write
Returns:
Type Description Writer this - 
    
finish(){ Buffer }
 - 
    
    
    
Finishes the write operation.
Returns:
Type Description Buffer Finished buffer  - 
    
    
    
Writes an unsigned 32 bit value as fixed 32 bits.
Name Type Description valuenumber Value to write
Returns:
Type Description Writer this - 
    
    
    
Writes an unsigned 64 bit value as fixed 64 bits.
Name Type Description valueLong | number | string Value to write
Throws:
Type Description TypeError If
valueis a string and no long library is present.Returns:
Type Description Writer this - 
    
    
    
Writes a float (32 bit).
Name Type Description valuenumber Value to write
Returns:
Type Description Writer this - 
    
    
    
Forks this writer's state by pushing it to a stack.
Calling reset or ldelim resets the writer to the previous state.Returns:
Type Description Writer this - 
    
    
    
Writes a signed 32 bit value as a varint.
Name Type Description valuenumber Value to write
Returns:
Type Description Writer this - 
    
    
    
Writes a signed 64 bit value as a varint.
Name Type Description valueLong | number | string Value to write
Throws:
Type Description TypeError If
valueis a string and no long library is present.Returns:
Type Description Writer this - 
    
    
    
Resets to the last state and appends the fork state's current write length as a varint followed by its operations.
Returns:
Type Description Writer this - 
    
    
    
Resets this instance to the last state.
Returns:
Type Description Writer this - 
    
    
    
Writes a signed 32 bit value as fixed 32 bits.
Name Type Description valuenumber Value to write
Returns:
Type Description Writer this - 
    
    
    
Writes a signed 64 bit value as fixed 64 bits.
Name Type Description valueLong | number | string Value to write
Throws:
Type Description TypeError If
valueis a string and no long library is present.Returns:
Type Description Writer this - 
    
    
    
Writes a 32 bit value as a varint, zig-zag encoded.
Name Type Description valuenumber Value to write
Returns:
Type Description Writer this - 
    
    
    
Writes a signed 64 bit value as a varint, zig-zag encoded.
Name Type Description valueLong | number | string Value to write
Throws:
Type Description TypeError If
valueis a string and no long library is present.Returns:
Type Description Writer this - 
    
    
    
Writes a string.
Name Type Description valuestring Value to write
Returns:
Type Description Writer this - 
    
    
    
Writes an unsigned 32 bit value as a varint.
Name Type Description valuenumber Value to write
Returns:
Type Description Writer this - 
    
    
    
Writes an unsigned 64 bit value as a varint.
Name Type Description valueLong | number | string Value to write
Throws:
Type Description TypeError If
valueis a string and no long library is present.Returns:
Type Description Writer this