-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Consider adding a Bytes []byte method to File (or documenting an example of how it can be achieved). #54
Comments
Having typed this up and considering it more closely, I no longer think this is a good fit and therefore shouldn't be done. But I posted it anyway for posterity and potential discussion. First, the
If that's the case, it might make more sense to map this to an Third, the One possible pivot from this is to document the approach of converting the contents of a |
I'll explain why File is exactly as it is: working with dom.File belongs into one or more separate packages that accept dom.File as input and do something useful with it. Be it exposing a full-fledged FileReader, or some helpers, or whatever other ways there are for working with files in JavaScript. File is only part of I'd prefer if we didn't document any ways of using File objects, either. Maybe we should make it clearer that File values are intended to be passed off to other packages. |
Agreed, the code doesn't belong in the If there's another package that implements this |
The issue with examples is two-fold.
As far as concrete actions ago, I (well, you) would add another paragraph to the existing documentation explaining that making use of File is deferred to other packages. You're of course also free to write said package, in which case issue 1 may not necessarily apply. |
I see the danger of that, but I still think that having an example for something commonly wanted but non-trivial is a net positive, and the downsides can be reduced by carefully wording it. E.g., "One of the ways this can be done is by using a But yeah, it's extra work and scope maintaining the example to make sure it provides a good recommendation rather than a suboptimal, outdated one. This work is reduced by not having an example, which isn't unreasonable. :) |
Currently, we have:
go-js-dom/dom.go
Lines 2460 to 2465 in 662b7b8
It might be helpful and worth considering changing it to have a
Bytes() []byte
method:(Extracted from gopherjs/gopherjs#776 and #32. /cc @inkeliz)
The text was updated successfully, but these errors were encountered: