Skip to content

How does AbstractFileSystem.cat_file work for http filesystems? #1388

Answered by martindurant
lobis asked this question in Q&A
Discussion options

You must be logged in to vote

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).

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@martindurant
Comment options

@lobis
Comment options

Answer selected by lobis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants