gapi: Add a bytes helper
Use bytes directly if we've got them.
This commit is contained in:
@@ -42,8 +42,15 @@ func CopyFileToFs(fs engine.Fs, src, dst string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// CopyStringToFs copies a file from src path on the local fs to a dst path on
|
||||
// fs.
|
||||
// CopyBytesToFs copies a list of bytes to a dst path on fs.
|
||||
func CopyBytesToFs(fs engine.Fs, b []byte, dst string) error {
|
||||
if err := fs.WriteFile(dst, b, Umask); err != nil {
|
||||
return errwrap.Wrapf(err, "can't write to file `%s`", dst)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CopyStringToFs copies a string to a dst path on fs.
|
||||
func CopyStringToFs(fs engine.Fs, str, dst string) error {
|
||||
if err := fs.WriteFile(dst, []byte(str), Umask); err != nil {
|
||||
return errwrap.Wrapf(err, "can't write to file `%s`", dst)
|
||||
|
||||
Reference in New Issue
Block a user