Object - io : ReadableByteChannel

ReadableByteChannel represents an input resource (i.e file). which could be used to source bytes.

read

(int nBytes)

returns byte | Error

Source bytes from a given input/output resource.

Number of bytes returned will be < 0 if the file reached its end.

This operation will be asynchronous, where the total number of required bytes might not be returned at a given time.

io:EofError will return once channel reach to it end.

Parameters

  • nBytes int
  • Positive integer. Represents the number of bytes which should be read

  • Return Type

    (byte | Error)
  • Content, the number of bytes read or EofError once channel reach to it end. Error if any error occurred.

base64Encode

()

returns ReadableByteChannel | Error

Encodes a given ReadableByteChannel with Base64 encoding scheme.

base64Decode

()

returns ReadableByteChannel | Error

Decodes a given ReadableByteChannel with Base64 encoding scheme.

close

()

returns Error?

Closes a given ReadableByteChannel.

  • Return Type

    (Error?)
  • Will return () if there's no error