@cryptotaxi247 / kubo / commits / 6622fd0a2

Add Some Comments to unixfs/format

License: MIT Signed-off-by: Zander Mackie <zmackie@gmail.com>

Zander Mackie committed Dec 9, 2016 at 07:27 UTC 6622fd0a2862b3c60b14e4b61d3da7533ee5a6e1
1 file changed +4 -1
unixfs/format.go
+4 -1
@@ -51,7 +51,7 @@ func FilePBData(data []byte, totalsize uint64) []byte {
51 return data
52 }
53
54 -// Returns Bytes that represent a Directory
54 +//FolderPBData returns Bytes that represent a Directory.
55 func FolderPBData() []byte {
56 pbfile := new(pb.Data)
57 typ := pb.Data_Directory
@@ -65,6 +65,7 @@ func FolderPBData() []byte {
65 return data
66 }
67
68 +//WrapData marshals raw bytes into a `Data_Raw` type protobuf message.
69 func WrapData(b []byte) []byte {
70 pbdata := new(pb.Data)
71 typ := pb.Data_Raw
@@ -81,6 +82,7 @@ func WrapData(b []byte) []byte {
82 return out
83 }
84
85 +//SymlinkData returns a `Data_Symlink` protobuf message for the path you specify.
86 func SymlinkData(path string) ([]byte, error) {
87 pbdata := new(pb.Data)
88 typ := pb.Data_Symlink
@@ -184,6 +186,7 @@ type Metadata struct {
186 Size uint64
187 }
188
189 +//MetadataFromBytes Unmarshals a protobuf message into Metadata.
190 func MetadataFromBytes(b []byte) (*Metadata, error) {
191 pbd := new(pb.Data)
192 err := proto.Unmarshal(b, pbd)