export.go 311 B

1234567891011121314
  1. package http
  2. import (
  3. "fmt"
  4. bm "go-common/library/net/http/blademaster"
  5. )
  6. func outBuf(c *bm.Context, buf []byte, name string) {
  7. c.Writer.Header().Set("Content-Type", "application/csv")
  8. c.Writer.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%s.csv", name))
  9. c.Writer.Write(buf)
  10. }