File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed
Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -7,18 +7,15 @@ title: Git Blobs | GitHub API
77* TOC
88{: toc }
99
10- Since blobs can be any arbitrary binary data, the input and responses
11- for the blob API takes an encoding parameter that can be either ` utf-8 `
12- or ` base64 ` . If your data cannot be losslessly sent as a UTF-8 string,
13- you can base64 encode it.
14-
1510Blobs leverage [ these custom media types] ( #custom-media-types ) . You can
1611read more about the use of media types in the API [ here] ( /v3/media/ ) .
1712
1813## Get a Blob
1914
2015 GET /repos/:owner/:repo/git/blobs/:sha
2116
17+ The ` content ` in the response will always be Base64 encoded.
18+
2219* Note* : This API supports blobs up to 100 megabytes in size.
2320
2421### Response
@@ -30,7 +27,14 @@ read more about the use of media types in the API [here](/v3/media/).
3027
3128 POST /repos/:owner/:repo/git/blobs
3229
33- ### Input
30+ ### Parameters
31+
32+ Name | Type | Description
33+ -----|------|-------------
34+ ` content ` |` string ` | ** Required** . The new blob's content.
35+ ` encoding ` |` string ` | The encoding used for ` content ` . Currently, ` "utf-8" ` and ` "base64" ` are supported. Default: ` "utf-8" ` .
36+
37+ ### Example Input
3438
3539<%= json : content => "Content of the blob", : encoding => "utf-8" %>
3640
Original file line number Diff line number Diff line change @@ -1854,11 +1854,11 @@ def fetch_content(key)
18541854 }
18551855
18561856 BLOB ||= {
1857- :content => "Content of the blob " ,
1858- :encoding => "utf-8 " ,
1857+ :content => "Q29udGVudCBvZiB0aGUgYmxvYg== \n " ,
1858+ :encoding => "base64 " ,
18591859 :url => "https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15" ,
18601860 :sha => "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15" ,
1861- :size => 100
1861+ :size => 19
18621862 }
18631863
18641864 BLOB_AFTER_CREATE ||= {
You can’t perform that action at this time.
0 commit comments