Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Posting images to Gists via the HTTP API

Is it possible to post binary files (such as images) to GitHub gists via the HTTP api?

In particular, the Gist api docs describe how to post files with string contents. There are two problems here for uploading images. One is that the api has something like a 64kb limit on POST requests (although this is not documented), which is pretty small for image files. Second, it's not obvious what encoding should be used on the wire for image files.

It's easy to do this by cloning the git repository associated with the Gist, adding the file, and pushing to the repository, but that requires git and I'd like to make this work on systems without git installed.

like image 722
Sam Tobin-Hochstadt Avatar asked Mar 19 '12 12:03

Sam Tobin-Hochstadt


People also ask

How do I upload images to GitHub API?

For uploading the file into GitHub you can go through basic steps: Get the file content using 'fs' module. Encode the content into base64 format. then use GitHub API “https://api.github.com/repos/{owner}/{repo}/contents/{file name}”.


1 Answers

The response I received from GitHub is that they don't intend to support posting binary files to Gists via the HTTP API, sadly.

like image 55
Sam Tobin-Hochstadt Avatar answered Sep 19 '22 23:09

Sam Tobin-Hochstadt