cid

package
v0.0.0-...-7a4b066 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package cid - provides methods for ContentID struct.

ContentID is wrapper over cid of a file stored in the system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentID

type ContentID struct {
	// contains filtered or unexported fields
}

ContentID represents a CID.

func NewContentID

func NewContentID(cidStr string) (*ContentID, error)

NewContentID creates a ContentID object from a cid string.

func NewContentIDFromFile

func NewContentIDFromFile(reader io.Reader) (*ContentID, error)

NewContentIDFromFile creates a ContentID object from a given file.

func NewRandomContentID

func NewRandomContentID() *ContentID

NewRandomContentID creates a random ContentID object.

func (ContentID) CalculateHash

func (n ContentID) CalculateHash() ([]byte, error)

CalculateHash hashes the values of a ContentID.

func (ContentID) Equals

func (n ContentID) Equals(other merkletree.Content) (bool, error)

Equals tests for equality of two ContentIDs.

func (*ContentID) FromBytes

func (n *ContentID) FromBytes(p []byte) error

FromBytes is used to turn bytes into ContentID.

func (*ContentID) GetHashID

func (n *ContentID) GetHashID() (string, error)

GetHashID gets a 32 bytes hash of this cid string in hex string format

func (*ContentID) ToBytes

func (n *ContentID) ToBytes() ([]byte, error)

ToBytes is used to turn CID into bytes.

func (*ContentID) ToString

func (n *ContentID) ToString() string

ToString returns a string for the ContentID.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL