draw2d/draw2dsvg/fileutil.go

19 lines
315 B
Go
Raw Normal View History

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