• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

wabarc/ipfs-pinner: A toolkit helps upload files to IPFS pinning services.

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

wabarc/ipfs-pinner

开源软件地址:

https://github.com/wabarc/ipfs-pinner

开源编程语言:

Go 92.9%

开源软件介绍:

ipfs-pinner

Go Report Card Go Reference Releases ipfs-pinner

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

Installation

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

Usage

Supported Pinning Services

Infura

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.

How to enable

Command-line:

Use flag -p infura.

$ ipfs-pinner
A CLI tool for pin files or directory to IPFS.

Usage:

  ipfs-pinner [flags] [path]...

Flags:

  -p string
        Pinner sceret or password.
  -t string
        IPFS pinner, supports pinners: infura, pinata, nftstorage, web3storage. (default "infura")
  -u string
        Pinner apikey or username.

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)
}

or requests with project authentication

import (
        "fmt"

        "github.com/wabarc/ipfs-pinner/pkg/infura"
)

func main() {
        inf := &infura.Infura{ProjectID: "your-project-id", ProjectSecret: "your-project-secret"}
        cid, err := inf.PinFile("file-to-path");
        if err != nil {
                fmt.Sprintln(err)
                return
        }
        fmt.Println(cid)
}

Pinata

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.

Environment variables

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>
How to enable

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)
}

NFT.Storage

NFT.Storage is a long-term storage service designed for off-chain NFT data (like metadata, images, and other assets) for up to 31GiB in size. Data is content addressed using IPFS, meaning the URL pointing to a piece of data (“ipfs://…”) is completely unique to that data.

How to enable

Command-line:

Use flag -p nftstorage.

ipfs-pinner -p nftstorage file-to-path

Go package:

import (
        "fmt"

        "github.com/wabarc/ipfs-pinner/pkg/nftstorage"
)

func main() {
        nft := nftstorage.NFTStorage{Apikey: "your api key"}
        cid, err := nft.PinFile("file-to-path");
        if err != nil {
                fmt.Sprintln(err)
                return
        }
        fmt.Println(cid)
}

Web3.Storage

Web3.Storage is a service to make building on top of Filecoin as simple as possible - giving the developers the power of open, distributed networks via a friendly JS client library. Behind the scenes, Web3.Storage is backed by Filecoin and makes content available via IPFS leveraging the unique properties of each network.

How to enable

Command-line:

Use flag -p web3storage.

ipfs-pinner -p web3storage file-to-path

Go package:

import (
        "fmt"

        "github.com/wabarc/ipfs-pinner/pkg/web3storage"
)

func main() {
        web3 := web3storage.Web3Storage{Apikey: "your api key"}
        cid, err := web3.PinFile("file-to-path");
        if err != nil {
                fmt.Sprintln(err)
                return
        }
        fmt.Println(cid)
}

License

Permissive GPL 3.0 license, see the LICENSE file for details.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap