Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: save and load methods for AbstractPaths #34

Closed
nickrobinson251 opened this issue Jan 18, 2019 · 4 comments · Fixed by JuliaIO/FileIO.jl#259
Closed

Enhancement: save and load methods for AbstractPaths #34

nickrobinson251 opened this issue Jan 18, 2019 · 4 comments · Fixed by JuliaIO/FileIO.jl#259

Comments

@nickrobinson251
Copy link

Extend FileIO to define the save and load methods for AbstractPaths.

The default behaviour could be to serialize the data to an IOBuffer and call write(path, bytes).

@rofinn
Copy link
Owner

rofinn commented Jan 31, 2019

This has been brought up before. #22 (comment)

Unfortunately, we'd need to overload a lot of methods in FileIO for that to work nicely. Supporting the Stream interface would be easy enough if open(::AbstractPath) return some FileBufferr format that we controlled, but I think you're want to support the File API which will be more work. Also, almost none of the formats we currently use (at Invenia) support that interface. I think a better starting point might be to start refactoring FileIO.

FWIW, what does extending save and load get us apart from the file format detection?

@nickrobinson251
Copy link
Author

The main benefit of extending save and load to AbstractPaths would be for non-local paths e.g. an S3Path, and so we don't have to keep track of when a "filepath" is a String or a *Path

@rofinn
Copy link
Owner

rofinn commented Jan 31, 2019

Right, but we'd need to modify the File type in FileIO for save and load to have the same behaviour. I suppose we could opt to only support a subset of the interface (e.g., use query to figure out the format and then only use the Stream type)?

@rofinn
Copy link
Owner

rofinn commented May 4, 2020

This is supported as of FileIO 1.3. Unfortunately, many backend file format packages assume filepaths are strings. We'll need to fix each package individually as they come up.

@rofinn rofinn closed this as completed May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants