more refactor
This commit is contained in:
1 parent
6413447f96
commit
3b78352109
16 files changed
+345
-219
No files matched your search
@@ -0,0 +1,23 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"encoding/pem"
|
||||
"os"
|
||||
)
|
||||
|
||||
func SavePEMFile(filename, blockType string, data []byte) error {
|
||||
file, err := os.Create(filename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
err = pem.Encode(file, &pem.Block{
|
||||
Type: blockType,
|
||||
Bytes: data,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user