Skip to content

Commit

Permalink
Add Some Comments to unixfs/format
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Zander Mackie <zmackie@gmail.com>
  • Loading branch information
zmackie committed Dec 9, 2016
1 parent 6fa58af commit 635d628
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion unixfs/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 635d628

Please sign in to comment.