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