Stream: beginners

Topic: Reading a set number of bytes from a file in basic-cli


view this post on Zulip Daniel Schierbeck (Jun 27 2024 at 08:09):

I'm trying to read from /dev/urandom, but because it's a virtual, infinite file, the task just hangs. Is there a way in basic-cli to read just a set amount of files from a file or stream?

view this post on Zulip Luke Boswell (Jun 27 2024 at 08:32):

Not currently. We could implement it.

view this post on Zulip Luke Boswell (Jun 27 2024 at 08:32):

What would youbexpect the API to be? File.readNBytes or similar?

view this post on Zulip Luke Boswell (Jun 27 2024 at 08:33):

We just added https://github.com/roc-lang/basic-cli/pull/206

view this post on Zulip Daniel Schierbeck (Jun 27 2024 at 09:53):

Yeah, something like that – or if more options are available, then File.readWithOptions { bytes : U64 } or something.


Last updated: Jul 06 2025 at 12:14 UTC