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

# README

go-unixfs

go-unixfs implements unix-like filesystem utilities on top of an ipld merkledag

Coverage Status Travis CI

ā— This repo is no longer maintained.

šŸ‘‰ We highly recommend switching to the maintained version at https://github.com/ipfs/boxo/tree/main/ipld/unixfs.

šŸŽļø 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.

Table of Contents

Package Directory

This package contains many subpackages, each of which can be very large on its own.

Top Level

The top level unixfs package defines the unixfs format datastructures, and some helper methods around it.

importers

The importer subpackage is what you'll use when you want to turn a normal file into a unixfs file.

io

The io subpackage provides helpers for reading files and manipulating directories. The DagReader takes a reference to a unixfs file and returns a file handle that can be read from and seeked through. The Directory interface allows you to easily read items in a directory, add items to a directory, and do lookups.

mod

The mod subpackage implements a DagModifier type that can be used to write to an existing unixfs file, or create a new one. The logic for this is significantly more complicated than for the dagreader, so its a separate type. (TODO: maybe it still belongs in the io subpackage though?)

hamt

The hamt subpackage implements a CHAMP hamt that is used in unixfs directory sharding.

archive

The archive subpackage implements a tar importer and exporter. The objects created here are not officially unixfs, but in the future, this may be integrated more directly.

test

The test subpackage provides several utilities to make testing unixfs related things easier.

Install

go get github.com/ipfs/go-unixfs

License

MIT Ā© Juan Batiz-Benet

# Packages

No description provided by the author
Package hamt implements a Hash Array Mapped Trie over ipfs merkledag nodes.
Package importer implements utilities used to create IPFS DAGs from files and readers.
Package io implements convenience objects for working with the ipfs unixfs data format.
Package mod provides DAG modification utilities to, for example, insert additional nodes in a unixfs DAG or truncate them.
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

BytesForMetadata wraps the given Metadata as a profobuf message of Data type, setting the DataType to Metadata.
DataSize returns the size of the contents in protobuf wrapped slice.
EmptyDirNode creates an empty folder Protonode.
EmptyFileNode creates an empty file Protonode.
Extract the `unixfs.FSNode` from the `ipld.Node` (assuming this was implemented by a `mdag.ProtoNode`).
FilePBData creates a protobuf File with the given byte slice and returns the marshaled protobuf bytes representing it.
FolderPBData returns Bytes that represent a Directory.
FromBytes unmarshals a byte slice as protobuf Data.
FSNodeFromBytes unmarshal a protobuf message onto an FSNode.
HAMTShardData return a `Data_HAMTShard` protobuf message Deprecated: use github.com/ipfs/boxo/ipld/unixfs.HAMTShardData.
MetadataFromBytes Unmarshals a protobuf Data message into Metadata.
NewFSNode creates a new FSNode structure with the given `dataType`.
ReadUnixFSNodeData extracts the UnixFS data from an IPLD node.
SymlinkData returns a `Data_Symlink` protobuf message for the path you specify.
UnwrapData unmarshals a protobuf messages and returns the contents.
WrapData marshals raw bytes into a `Data_Raw` type protobuf message.

# Constants

Deprecated: use github.com/ipfs/boxo/ipld/unixfs.TDirectory.
Deprecated: use github.com/ipfs/boxo/ipld/unixfs.TFile.
Deprecated: use github.com/ipfs/boxo/ipld/unixfs.THAMTShard.
Deprecated: use github.com/ipfs/boxo/ipld/unixfs.TMetadata.
Deprecated: use github.com/ipfs/boxo/ipld/unixfs.TRaw.
Deprecated: use github.com/ipfs/boxo/ipld/unixfs.TSymlink.

# Variables

Deprecated: use github.com/ipfs/boxo/ipld/unixfs.ErrMalformedFileFormat.
Deprecated: use github.com/ipfs/boxo/ipld/unixfs.ErrUnrecognizedType.

# Structs

An FSNode represents a filesystem object using the UnixFS specification.
A LinkResult for any parallel enumeration of links TODO: Should this live in go-ipld-format? Deprecated: use github.com/ipfs/boxo/ipld/unixfs.LinkResult.
Metadata is used to store additional FSNode information.