Skip to content

Commit 08177d7

Browse files
committed
Update README.md
1 parent c45743e commit 08177d7

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

README.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,49 @@ Github.js
33

44
Ever wanted to store a file on Github right from the browser? Here you are.
55

6+
7+
Expose API for a given repository.
8+
69
```js
710
var github = new Github({
811
username: "YOU_USER",
912
password: "YOUR_PASSWORD",
1013
auth: "basic"
1114
});
1215

13-
// Expose API for a given repository
14-
1516
var repo = github.getRepo(reponame);
17+
```
18+
19+
Retrieve all available branches (aka heads) of a repository.
1620

17-
// Store contents at a certain path (assumes UTF-8)
18-
// Files that don't yet exist are created on the fly.
21+
```js
22+
repo.listBranches, function(err, branches) {
23+
24+
});
25+
```
1926

20-
repo.write('path/to/file', 'YOUR_NEW_CONTENTS', 'YOUR_COMMIT_MESSAGE', function(err) {
27+
Store contents at a certain path, where files that don't yet exist are created on the fly.
28+
29+
```js
30+
repo.write('master', 'path/to/file', 'YOUR_NEW_CONTENTS', 'YOUR_COMMIT_MESSAGE', function(err) {
31+
32+
});
33+
```
34+
35+
Not only can you can write files, you can of course read them.
36+
37+
```js
38+
repo.read('master', 'path/to/file', function(err, data) {
2139

2240
});
2341
```
2442

25-
Not only can you can write files, you can of course read them:
43+
Listing all files of a repository is easy too.
2644

2745
```js
2846
// Retrieve contents of a certain file (assumes UTF-8)
2947

30-
repo.read('path/to/file', function(err, data) {
48+
repo.list('master', 'path/to/file', function(err, data) {
3149

3250
});
3351
```

0 commit comments

Comments
 (0)