Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

Commit a5c3262

Browse files
committed
getFile
1 parent 2d7ad67 commit a5c3262

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

repo_file.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2014 The Gogs Authors. All rights reserved.
2+
// Use of this source code is governed by a MIT-style
3+
// license that can be found in the LICENSE file.
4+
5+
package gogs
6+
7+
import (
8+
"fmt"
9+
)
10+
11+
// GetFile downloads a file of repository, ref can be branch/tag/commit.
12+
// e.g.: ref -> master, tree -> macaron.go(no leading slash)
13+
func (c *Client) GetFile(user, repo, ref, tree string) ([]byte, error) {
14+
return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/raw/%s/%s", user, repo, ref, tree), nil, nil)
15+
}

0 commit comments

Comments
 (0)