WriteToFile writes data to a file
(data []byte, filePath string)
| 26 | |
| 27 | // WriteToFile writes data to a file |
| 28 | func WriteToFile(data []byte, filePath string) error { |
| 29 | err := os.MkdirAll(filepath.Dir(filePath), 0755) |
| 30 | if err != nil { |
| 31 | return err |
| 32 | } |
| 33 | |
| 34 | return os.WriteFile(filePath, data, 0666) |
| 35 | } |
| 36 | |
| 37 | // ReadFile reads a file with a given limit |
| 38 | func ReadFile(path string, limit int64) ([]byte, error) { |
no outgoing calls