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

API Method Naming #1

Open
jordan-wright opened this issue Apr 17, 2014 · 2 comments
Open

API Method Naming #1

jordan-wright opened this issue Apr 17, 2014 · 2 comments

Comments

@jordan-wright
Copy link

Nice job!!

I'd recommend renaming the API to allow a general io.Reader and io.Writer. Currently, you are forced to interact with on-disk files only. What if I want to write to a .tar.gz from a HTTP response body, etc.? Feel free to check the Reddit comments here for more on this.

I was faced with a similar problem with my email package. I resolved it by making Attach() (in your case Compress() and Extract()) take an io.Reader (or io.Writer) as the argument, and made a separate function, AttachFile(), which served as a convenience function.

So, I propose that you make Compress() and Extract() more general and allow any reader and writer, and make new functions, CompressFile() and ExtractFile() serve as convenience.

I understand that you're aiming for simplicity, but in this case much more flexibility comes with little sacrifice to usability. Just a thought.

Keep up the good work!

@walle
Copy link
Owner

walle commented Apr 21, 2014

Thank you for taking the time to add this issue, with a lot of background info.

Sounds like a good idea, I don't know if I will add this right now though. I will keep this issue open, and take a look at it next time I get a little time to work on side projects like this.

Yes, you keep up the good work you too!

@jordan-wright
Copy link
Author

Sounds good - never hesitate to shoot me an email if I can help in any way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants