v1.2.1
This commit is contained in:
18
internal/serialization/serialize.go
Normal file
18
internal/serialization/serialize.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package serialization
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
type Writable interface {
|
||||
WriteToFile(string) error
|
||||
}
|
||||
|
||||
type Serialized []byte
|
||||
|
||||
// WriteToFile writes serialized data to specified file.
|
||||
//
|
||||
// Make sure to use .json extension for best compatibility.
|
||||
func (s Serialized) WriteToFile(path string) error {
|
||||
return os.WriteFile(path, s, 0600)
|
||||
}
|
||||
Reference in New Issue
Block a user