You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: obstore/python/obstore/_buffered.pyi
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,7 @@ def open_reader(
21
21
path: str,
22
22
*,
23
23
buffer_size: int=1024*1024,
24
+
size: int|None=None,
24
25
) ->ReadableFile:
25
26
"""Open a readable file object from the specified location.
26
27
@@ -30,6 +31,11 @@ def open_reader(
30
31
31
32
Keyword Args:
32
33
buffer_size: The minimum number of bytes to read in a single request. Up to `buffer_size` bytes will be buffered in memory.
34
+
size: Optional byte size of the object. When provided, skips the HEAD request used to fetch the file size. Useful for callers that already know the size from external metadata.
35
+
36
+
The caller is responsible for accuracy: a value larger than the actual file surfaces as a read-time range error, a value smaller causes silent truncation.
37
+
38
+
When `size` is provided, the resulting reader's `meta` attribute omits `last_modified` (since it was not fetched). Callers that need that field should call `open_reader` without `size`. Defaults to `None`.
33
39
34
40
Returns:
35
41
ReadableFile
@@ -41,6 +47,7 @@ async def open_reader_async(
41
47
path: str,
42
48
*,
43
49
buffer_size: int=1024*1024,
50
+
size: int|None=None,
44
51
) ->AsyncReadableFile:
45
52
"""Call `open_reader` asynchronously, returning a readable file object with asynchronous operations.
0 commit comments