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 Request: Method to Create Hostsfile from String #55

Open
spencercjh opened this issue Jun 25, 2024 · 2 comments
Open

Feature Request: Method to Create Hostsfile from String #55

spencercjh opened this issue Jun 25, 2024 · 2 comments

Comments

@spencercjh
Copy link

I would like to express my gratitude for your contributions to the project. The two New methods for reading from a file are extremely convenient and useful in my work.

However, I've encountered a scenario where I need to read the contents of a hostsfile stored in memory. My workaround is to write the in-memory hostsfile to a temporary file and then use the existing API to read it. This process is not ideal and could be streamlined.

Therefore, I would like to propose a new feature: a NewHostsFromStr method that allows the creation of a hostsfile directly from a string. Maybe we can just expose the existing test method loadString?

If this proposal aligns with the project's goals, I want to contribute to its implementation. I look forward to hearing your thoughts on this suggestion.

Thank you for considering my proposal.

@luthermonson
Copy link
Contributor

only concern i have with exposing it is probably all the funcs which need a file path to work e.g. IsWritable and Flush. Would you expect to set the Path yourself for those to work or would NewHostsFromStr take two params, the string and the path where you eventually want it?

@spencercjh
Copy link
Author

only concern i have with exposing it is probably all the funcs which need a file path to work e.g. IsWritable and Flush. Would you expect to set the Path yourself for those to work or would NewHostsFromStr take two params, the string and the path where you eventually want it?

I got your points. This may require reimplementing all the existing interfaces all over again.

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

No branches or pull requests

2 participants