jow- / ucode

JavaScript-like language with optional templating
ISC License
87 stars 24 forks source link

fs: expose `getdelim()` functionality through `fd.read()` #118

Closed jow- closed 1 year ago

jow- commented 1 year ago

When fd.read() is invoked with a single-character string argument, invoke getdelim() internally to read the input until the give character or EOF. This is useful for reading character delimited input data.

For example fd.read('\n') will read any data up to the first newline (or EOF) while fd.read('\0x00') will read until the first null byte.

Signed-off-by: Jo-Philipp Wich jo@mein.io