WriteFile writes an index file to the given destination path. The mode on the file is set to 'mode'.
(dest string, mode os.FileMode)
| 243 | // |
| 244 | // The mode on the file is set to 'mode'. |
| 245 | func (i IndexFile) WriteFile(dest string, mode os.FileMode) error { |
| 246 | b, err := yaml.Marshal(i) |
| 247 | if err != nil { |
| 248 | return err |
| 249 | } |
| 250 | return fileutil.AtomicWriteFile(dest, bytes.NewReader(b), mode) |
| 251 | } |
| 252 | |
| 253 | // WriteJSONFile writes an index file in JSON format to the given destination |
| 254 | // path. |