FilePaths.jl icon indicating copy to clipboard operation
FilePaths.jl copied to clipboard

Support for parsing protocols

Open asinghvi17 opened this issue 1 year ago • 1 comments

It's pretty common to address files as:

protocol://path/to/file

examples of protocol being file, http[s], s3, ftp, but also things like reference (for https://fsspec.github.io/kerchunk/) or even more exotic protocols.

Should there be some form of protocol registry, and maybe an edit to the @p_str macro, which will return the correct path type if that package is loaded, and an informative error ("please load AWSS3.jl for S3 paths") if not?

For reference, https://github.com/JuliaIO/Zarr.jl already does this kind of thing, and I'd like to port quite a few of their Store objects over to a FilePathsBase like interface, since the hard work has already been mostly done.

asinghvi17 avatar Aug 27 '24 04:08 asinghvi17

I believe FilePathsBase.jl already does this.

  • Registration code - https://github.com/rofinn/FilePathsBase.jl/blob/master/src/FilePathsBase.jl#L118
  • Parsing/Construction logic - https://github.com/rofinn/FilePathsBase.jl/blob/master/src/path.jl#L14
  • External usage in AWSS3.jl - https://github.com/JuliaCloud/AWSS3.jl/blob/master/src/AWSS3.jl#L71

rofinn avatar Sep 19 '24 18:09 rofinn