Add DecodeMeta function for decoding metadata from an io.Reader.
This commit is contained in:
parent
43084fb5bb
commit
ccff4e56c0
8
meta.go
8
meta.go
@ -1,5 +1,6 @@
|
|||||||
package step
|
package step
|
||||||
|
|
||||||
|
import "io"
|
||||||
import "strconv"
|
import "strconv"
|
||||||
import "strings"
|
import "strings"
|
||||||
|
|
||||||
@ -70,3 +71,10 @@ func ParseMeta (input string) (Meta, error) {
|
|||||||
}
|
}
|
||||||
return meta, nil
|
return meta, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DecodeMeta decodes metadata from an io.Reader. The entire reader is consumed.
|
||||||
|
func DecodeMeta (input io.Reader) (Meta, error) {
|
||||||
|
buffer, err := io.ReadAll(input)
|
||||||
|
if err != nil { return nil, err }
|
||||||
|
return ParseMeta(string(buffer))
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user