in index.go [473:500]
func saveDataStreamsToFile(datastreams []map[string]interface{}) {
// Marshal the data into a JSON string
jsonData, err := json.Marshal(datastreams)
if err != nil {
fmt.Println("Error marshaling JSON:", err)
return
}
// Define the file path
filePath := "result_data_stream.json"
// Create or open the file for writing
file, err := os.Create(filePath)
if err != nil {
fmt.Println("Error creating file:", err)
return
}
defer file.Close()
// Write the JSON data to the file
_, err = file.Write(jsonData)
if err != nil {
fmt.Println("Error writing JSON to file:", err)
return
}
fmt.Printf("JSON data saved to %s\n", filePath)
}