Skip to content

Commit 872d47e

Browse files
author
Hubot
committed
Sync changes from upstream repository
1 parent 9f1093e commit 872d47e

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

content/v3/git/blobs.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff 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-
1510
Blobs leverage [these custom media types](#custom-media-types). You can
1611
read 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

lib/resources.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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 ||= {

0 commit comments

Comments
 (0)