Add isseekable
to Stream/IO interface?
#24242
Labels
io
Involving the I/O subsystem: libuv, read, write, etc.
isseekable
to Stream/IO interface?
#24242
If I'm writing some code that takes an
IO
object externally, I might want to do different things based on whether the given stream is seekable, but as of now there isn't a standard way to check for it.Here's a mock use-case that matches some real code I'm writing right now, where there's a leading length field in the file format that's should be written, but it's not the end of the world if its not:
Which the user might use like so:
At first it seems like this is a use-case for the
mark
API, but that requires you to just keep buffering the whole file, which could be gigabytes.The text was updated successfully, but these errors were encountered: