https://github.com/ipfs/go-ipfs-api
The go interface to ipfs's HTTP API
https://github.com/ipfs/go-ipfs-api
Last synced: 3 months ago
JSON representation
The go interface to ipfs's HTTP API
- Host: GitHub
- URL: https://github.com/ipfs/go-ipfs-api
- Owner: ipfs
- License: mit
- Archived: true
- Created: 2015-05-13T05:09:55.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-02-07T11:07:13.000Z (almost 2 years ago)
- Last Synced: 2024-11-17T12:14:00.658Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 411 KB
- Stars: 456
- Watchers: 34
- Forks: 178
- Open Issues: 33
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- go-awesome - go-ipfs-api - IPFS (开源类库 / 网络)
- go-awesome - go-ipfs-api - IPFS (Open source library / The Internet)
README
## ⚠️ This package is no longer being maintained ⚠️
Please use [`kubo/client/rpc`](https://github.com/ipfs/kubo/tree/master/client/rpc) instead. In rare case the new library does not offer a feature this one does, fill issue in Kubo, or better, submit a PR that adds it to [`kubo/client/rpc`](https://github.com/ipfs/kubo/tree/master/client/rpc).
For more details about the decision, see https://github.com/ipfs/kubo/issues/9124.
# go-ipfs-api
[](https://protocol.ai)
[](https://ipfs.io/)
[](https://app.element.io/#/room/#ipfs:matrix.org)
[](https://github.com/RichardLitt/standard-readme)
[](https://godoc.org/github.com/ipfs/go-ipfs-api)
[](https://travis-ci.org/ipfs/go-ipfs-api)

> The go interface to ipfs's HTTP API
## Install
```sh
go install github.com/ipfs/go-ipfs-api@latest
```
This will download the source into `$GOPATH/src/github.com/ipfs/go-ipfs-api`.
## Usage
See [the godocs](https://godoc.org/github.com/ipfs/go-ipfs-api) for details on available methods. This should match the specs at [ipfs/specs (Core API)](https://github.com/ipfs/specs/blob/master/API_CORE.md); however, there are still some methods which are not accounted for. If you would like to add any of them, see the contribute section below. See also the [HTTP API](https://docs.ipfs.io/reference/http/api/).
### Example
Add a file with the contents "hello world!":
```go
package main
import (
"fmt"
"strings"
"os"
shell "github.com/ipfs/go-ipfs-api"
)
func main() {
// Where your local node is running on localhost:5001
sh := shell.NewShell("localhost:5001")
cid, err := sh.Add(strings.NewReader("hello world!"))
if err != nil {
fmt.Fprintf(os.Stderr, "error: %s", err)
os.Exit(1)
}
fmt.Printf("added %s", cid)
}
```
For a more complete example, please see: https://github.com/ipfs/go-ipfs-api/blob/master/tests/main.go
## Contribute
Contributions are welcome! Please check out the [issues](https://github.com/ipfs/go-ipfs-api/issues).
### Want to hack on IPFS?
[](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)
## License
MIT