Categorygithub.com/ipfs/go-ipfs-util
modulepackage
0.0.3
Repository: https://github.com/ipfs/go-ipfs-util.git
Documentation: pkg.go.dev

# README

go-ipfs-util

standard-readme compliant

Common utilities used by go-ipfs and other related go packages

ā— This repo is no longer maintained.

šŸ‘‰ We highly recommend switching to the maintained version at https://github.com/ipfs/boxo/tree/main/util. šŸŽļø Good news! There is tooling and documentation to expedite a switch in your repo.

āš ļø If you continue using this repo, please note that security fixes will not be provided (unless someone steps in to maintain it).

šŸ“š Learn more, including how to take the maintainership mantle or ask questions, here.

Install

This is a Go module which can be installed with go get github.com/ipfs/go-ipfs-util. go-ipfs-util is however packaged with Gx, so it is recommended to use Gx to install it (see Usage section).

Usage

This module is packaged with Gx. In order to use it in your own project do:

go get -u github.com/whyrusleeping/gx
go get -u github.com/whyrusleeping/gx-go
cd <your-project-repository>
gx init
gx import github.com/ipfs/go-ipfs-util
gx install --global
gx-go --rewrite

Please check Gx and Gx-go documentation for more information.

Want to hack on IPFS?

License

MIT

# Functions

ErrCast is returned when a cast fails AND the program should not panic.
ExpandPathnames takes a set of paths and turns them into absolute paths Deprecated: use github.com/ipfs/boxo/util.ExpandPathnames.
FileExists check if the file with the given path exits.
FormatRFC3339 returns the string representation of the UTC value of the given time in RFC3339Nano format.
GetenvBool is the way to check an env var as a boolean Deprecated: use github.com/ipfs/boxo/util.GetenvBool.
Hash is the global IPFS hash function.
IsValidHash checks whether a given hash is valid (b58 decodable, len > 0) Deprecated: use github.com/ipfs/boxo/util.IsValidHash.
NewSeededRand returns a random bytes reader initialized with the given seed.
NewTimeSeededRand returns a random bytes reader which has been initialized with the current time.
ParseRFC3339 parses an RFC3339Nano-formatted time stamp and returns the UTC time.
Partition splits a subject 3 parts: prefix, separator, suffix.
RPartition splits a subject 3 parts: prefix, separator, suffix.
XOR takes two byte slices, XORs them together, returns the resulting slice.

# Constants

DefaultIpfsHash is the current default hash function used by IPFS.

# Variables

Debug is a global flag for debugging.
ErrNotImplemented signifies a function has not been implemented yet.
ErrSearchIncomplete implies that a search type operation didn't find the expected node, but did find 'a' node.
ErrTimeout implies that a timeout has been triggered Deprecated: use github.com/ipfs/boxo/util.ErrTimeout.
TimeFormatIpfs is the format ipfs uses to represent time in string form.

# Type aliases

MultiErr is a util to return multiple errors Deprecated: use github.com/ipfs/boxo/util.MultiErr.