WriteToFile serializes the document out to the file at path 'filepath'.
(filepath string)
| 448 | |
| 449 | // WriteToFile serializes the document out to the file at path 'filepath'. |
| 450 | func (d *Document) WriteToFile(filepath string) error { |
| 451 | f, err := os.Create(filepath) |
| 452 | if err != nil { |
| 453 | return err |
| 454 | } |
| 455 | defer f.Close() |
| 456 | _, err = d.WriteTo(f) |
| 457 | return err |
| 458 | } |
| 459 | |
| 460 | // WriteToBytes serializes this document into a slice of bytes. |
| 461 | func (d *Document) WriteToBytes() (b []byte, err error) { |