cidutil

package
v0.0.0-...-4221867 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeFileCID

func ComputeFileCID(f io.ReadSeeker) (string, error)

func ImageVariantPath

func ImageVariantPath(id, variant string) string

/img/shard/orig_cid/150x150.jpg

func IsLegacyCID

func IsLegacyCID(cid string) bool

Returns true both for "Qm" CIDs AND for for keys like "Qmwhatever/150x150.jpg" to support legacy migrated keys

func IsLegacyCIDStrict

func IsLegacyCIDStrict(cid string) bool

Only returns true for exact v0 CIDs (46 chars and start with "Qm")

func ShardCID

func ShardCID(cidStr string) string

Returns a sharded filepath/key for CID based on CID version. V0: last 3 chars, offset by 1 V1: last 5 chars Fallback: unchanged (for legacy migrated keys like "Qm.../150x150.jpg")

func UnescapeCidParam

func UnescapeCidParam(next echo.HandlerFunc) echo.HandlerFunc

func ValidateCID

func ValidateCID(expectedCID string, f io.ReadSeeker) error

note: any Qm CID will be invalid because its hash won't match the contents

Types

This section is empty.

Jump to

Keyboard shortcuts

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