20 lines
258 B
Go
20 lines
258 B
Go
package html_components
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
)
|
|
|
|
func CreateFile(path string, src io.Reader) error {
|
|
dst, err := os.Create(path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer dst.Close()
|
|
|
|
if _, err = io.Copy(dst, src); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|