From 635d6280dbc15c7052c9fde1016c44822a98887f Mon Sep 17 00:00:00 2001 From: Zander Mackie Date: Fri, 9 Dec 2016 07:27:16 -0500 Subject: [PATCH] Add Some Comments to unixfs/format License: MIT Signed-off-by: Zander Mackie --- unixfs/format.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)