File-like Object¶
Native support for reading from object stores as a file-like object.
Use obstore.open
or obstore.open_async
to open files. Writing files in this way is not yet supported.
obstore.open ¶
open(store: ObjectStore, path: str) -> ReadableFile
Open a file object from the specified location.
Parameters:
-
store
(ObjectStore
) –The ObjectStore instance to use.
-
path
(str
) –The path within ObjectStore to retrieve.
Returns:
-
ReadableFile
–ReadableFile
obstore.open_async
async
¶
open_async(store: ObjectStore, path: str) -> AsyncReadableFile
Call open
asynchronously, returning a file object with asynchronous operations.
Refer to the documentation for [open][object_store_rs.open].
obstore.ReadableFile ¶
A readable file object with synchronous operations.
read ¶
Read up to size
bytes from the object and return them. As a convenience, if
size is unspecified or None
, all bytes until EOF are returned.
readall ¶
readall() -> Buffer
Read and return all the bytes from the stream until EOF, using multiple calls to the stream if necessary.
readline ¶
readline() -> Buffer
Read a single line of the file, up until the next newline character.
readlines ¶
Read all remaining lines into a list of buffers
seek ¶
Change the stream position to the given byte offset, interpreted relative to the position indicated by whence, and return the new absolute position. Values for whence are:
os.SEEK_SET
or 0: start of the stream (the default);offset
should be zero or positiveos.SEEK_CUR
or 1: current stream position;offset
may be negativeos.SEEK_END
or 2: end of the stream;offset
is usually negative
obstore.AsyncReadableFile ¶
A readable file object with asynchronous operations.
read
async
¶
Read up to size
bytes from the object and return them. As a convenience, if
size is unspecified or None
, all bytes until EOF are returned.
readall
async
¶
readall() -> Buffer
Read and return all the bytes from the stream until EOF, using multiple calls to the stream if necessary.
readline
async
¶
readline() -> Buffer
Read a single line of the file, up until the next newline character.
readlines
async
¶
Read all remaining lines into a list of buffers
seek
async
¶
Change the stream position to the given byte offset, interpreted relative to the position indicated by whence, and return the new absolute position. Values for whence are:
os.SEEK_SET
or 0: start of the stream (the default);offset
should be zero or positiveos.SEEK_CUR
or 1: current stream position;offset
may be negativeos.SEEK_END
or 2: end of the stream;offset
is usually negative