ipfs-pinner
is a toolkit to help upload files or specific content id to IPFS pinning services.
Supported Golang version: See .github/workflows/testing.yml
Via Golang package get command
go get -u github.com/wabarc/ipfs-pinner/cmd/ipfs-pinner
Using Snapcraft (on GNU/Linux)
snap install ipfs-pinner
Infura is a freemium pinning service that doesn't require any additional setup. It's the default one used. Please bear in mind that Infura is a free service, so there is probably a rate-limiting.
Command-line:
Use flag -p infura
.
$ ipfs-pinner
A CLI tool for pin files to IPFS.
Usage:
ipfs-pinner [options] [file1] ... [fileN]
-p string
IPFS pinner, supports pinners: infura, pinata. (default "infura")
Go package:
import (
"fmt"
"github.com/wabarc/ipfs-pinner/pkg/infura"
)
func main() {
cid, err := infura.PinFile("file-to-path");
if err != nil {
fmt.Sprintln(err)
return
}
fmt.Println(cid)
}
Pinata is another freemium pinning service. It gives you more control over what's uploaded. You can delete, label and add custom metadata. This service requires signup.
Unix*:
IPFS_PINNER_PINATA_API_KEY=<api key>
IPFS_PINNER_PINATA_SECRET_API_KEY=<secret api key>
Windows:
set IPFS_PINNER_PINATA_API_KEY=<api key>
set IPFS_PINNER_PINATA_SECRET_API_KEY=<secret api key>
Command-line:
Use flag -p pinata
.
ipfs-pinner -p pinata file-to-path
Go package:
import (
"fmt"
"github.com/wabarc/ipfs-pinner/pkg/pinata"
)
func main() {
pnt := pinata.Pinata{Apikey: "your api key", Secret: "your secret key"}
cid, err := pnt.PinFile("file-to-path");
if err != nil {
fmt.Sprintln(err)
return
}
fmt.Println(cid)
}
Permissive GPL 3.0 license, see the LICENSE file for details.