draw2d/draw2dsvg/fileutil.go
2017-12-21 15:52:26 +01:00

19 lines
No EOL
315 B
Go

package draw2dsvg
import (
"os"
"bytes"
_ "errors"
)
func SaveToSvgFile(filePath string, svg *SVG) error {
f, err := os.Create(filePath)
if err != nil {
return err
}
defer f.Close()
bytes.NewBuffer((*bytes.Buffer)(svg).Bytes()).WriteTo(f) // clone buffer to make multiple writes possible
return nil
}