How does AbstractFileSystem.cat_file
work for http filesystems?
#1388
-
I would like to use I could not find any documentation on how this works in detail. I would love to know if fetching a given range of a file does A or B:
In particular I am interested in performing requests for different ranges of a single file in parallel, currently using a single I would love any comment in this regard. Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It does B, by including a Range header in the request (see here). This will be a problem when the server doesn't respect the request - sometimes you get an error back (which is fine), sometimes the wrong range (perhaps depending on encoding) and sometimes the whole file for every request - you should experiment first. If you want to fetch many ranges from one or more files, you might well want to use |
Beta Was this translation helpful? Give feedback.
It does B, by including a Range header in the request (see here). This will be a problem when the server doesn't respect the request - sometimes you get an error back (which is fine), sometimes the wrong range (perhaps depending on encoding) and sometimes the whole file for every request - you should experiment first.
If you want to fetch many ranges from one or more files, you might well want to use
cat_ranges
, designed for this job. See also fsspec.utils.merge_offset_ranges, for ways to combine a set of ranges (adjacent requests should be combined and nearby ones maybe, since each request takes some overhead even when async).