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

[feature] Add the ability to read ziped ntfs #773

Merged
merged 4 commits into from
May 3, 2021

Conversation

antoine-de
Copy link
Contributor

change the transit_model::ntfs::read method to be able to read a zip archive

like the gtfs module, the ntfs module now have:

let model = transit_model::ntfs::read("path_to_a_ntfs_directory_or_a_zip_archive")?; // <- main method, black magic to detect zip or not
let model = transit_model::ntfs::read_from_path("path_to_a_ntfs_directory")?;
let model = transit_model::ntfs::read_from_zip("path_to_a_zip")?;

It also brings a lower level from_read method if one day we want more flexible reading options like:

let url = "http://some_url/ntfs.zip";
let resp = reqwest::blocking::get(url)?; // or async call
let data = std::io::Cursor::new(resp.bytes()?.to_vec());
let model = transit_model::ntfs::from_read(data, &url)?;

The global behavior can be check in the test file tests/read_ntfs.rs.

Note: from method visibility have been changed from pub to pub(crate) to not expose the FileHandler, so this is a breaking change. However I don't think those methods were used in practice. At least not internally by Kisio.

Copy link
Contributor

@woshilapin woshilapin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing pub(crate) everywhere and having the risk to expose stuff we do not want... maybe it's time to remove the pub mod ntfs; in src/lib.rs and only expose the methods that intended to be exposed, what do you think?

@antoine-de
Copy link
Contributor Author

hum I think we want a pub mod here, we want to be able to do transit_model::ntfs::read no?

@antoine-de antoine-de merged commit b2b64bb into hove-io:master May 3, 2021
@antoine-de antoine-de deleted the ziped_ntfs branch May 3, 2021 08:51
@ArnaudOggy ArnaudOggy mentioned this pull request May 3, 2021
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 this pull request may close these issues.

3 participants