diff --git a/unixfs/format.go b/unixfs/format.go index 7a602362eed6..96dd109d17bd 100644 --- a/unixfs/format.go +++ b/unixfs/format.go @@ -51,7 +51,7 @@ func FilePBData(data []byte, totalsize uint64) []byte { return data } -// Returns Bytes that represent a Directory +//FolderPBData returns Bytes that represent a Directory. func FolderPBData() []byte { pbfile := new(pb.Data) typ := pb.Data_Directory @@ -65,6 +65,7 @@ func FolderPBData() []byte { return data } +//WrapData marshals raw bytes into a `Data_Raw` type protobuf message. func WrapData(b []byte) []byte { pbdata := new(pb.Data) typ := pb.Data_Raw @@ -81,6 +82,7 @@ func WrapData(b []byte) []byte { return out } +//SymlinkData returns a `Data_Symlink` protobuf message for the path you specify. func SymlinkData(path string) ([]byte, error) { pbdata := new(pb.Data) typ := pb.Data_Symlink @@ -184,6 +186,7 @@ type Metadata struct { Size uint64 } +//MetadataFromBytes Unmarshals a protobuf message into Metadata. func MetadataFromBytes(b []byte) (*Metadata, error) { pbd := new(pb.Data) err := proto.Unmarshal(b, pbd)