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

write file like image #172

Closed
Moonrise1275 opened this issue Mar 31, 2015 · 5 comments
Closed

write file like image #172

Moonrise1275 opened this issue Mar 31, 2015 · 5 comments

Comments

@Moonrise1275
Copy link

Can i write image (like uploaded via )to my github repo with github.js?
If i can, how can i do this? Just pass File object instead of string?
If i can't, is there a plan to support it?

@Moonrise1275
Copy link
Author

Anyway, thanks for your hard work.
Cheers.

@agarrharr
Copy link

I'm assuming this is possible since prose supports image uploads. But I would also like to see documentation on how to do this.

@AurelioDeRosa
Copy link
Member

This is already possible using the library. I explain how to do that in this article. I think this issue can be closed, but I'll wait for a confirmation from other maintainers.

@aendra-rininsland
Copy link
Member

The workaround given by @AurelioDeRosa is breaking due to the unicode handling added in #203. It's really hard juggling dependencies between NodeJS-land and Browserville... 😅

I've thus added a "encode" property to the repo.write options array that, when set to false, assumes content will be base64-encoded elsewhere (e.g., in a FileReader or some such).

@AurelioDeRosa's article is really good and is still a good reference if trying to send images to GitHub, but please also see this spec, lines 27-42 and 362.

Closing as resolved. The "encode" property will be removed or depreciated next release as by then we'll have found a catch-all solution for handling base64 strings.

@auiechko
Copy link

I have a problem, it says that repo.write(''BRANCH_NAME'',"FILE.txt","CONTENT","YOUR_COMMIT_MESSAGE") is not a function, can anybody help me with that problem?

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

5 participants