MCPcopy
hub / github.com/putyy/res-downloader / batchExport

Method batchExport

core/http.go:389–408  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

387}
388
389func (h *HttpServer) batchExport(w http.ResponseWriter, r *http.Request) {
390 var data struct {
391 Content string `json:"content"`
392 }
393 if err := json.NewDecoder(r.Body).Decode(&data); err != nil {
394 h.error(w, err.Error())
395 return
396 }
397 fileName := filepath.Join(globalConfig.SaveDirectory, "res-downloader-"+shared.GetCurrentDateTimeFormatted()+".txt")
398 err := os.WriteFile(fileName, []byte(data.Content), 0644)
399 if err != nil {
400 h.error(w, err.Error())
401 return
402 }
403
404 _ = shared.OpenFolder(fileName)
405 h.success(w, respData{
406 "file_name": fileName,
407 })
408}

Callers 1

HandleApiFunction · 0.80

Calls 4

errorMethod · 0.95
successMethod · 0.95
OpenFolderFunction · 0.92

Tested by

no test coverage detected