You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
449 B

  1. package operation
  2. import (
  3. "code.google.com/p/weed-fs/go/glog"
  4. "net/http"
  5. )
  6. func DeleteFile(server string, fileId string) error {
  7. fileUrl, err := LookupFileId(server, fileId)
  8. if err != nil {
  9. return err
  10. }
  11. return Delete(fileUrl)
  12. }
  13. func Delete(url string) error {
  14. req, err := http.NewRequest("DELETE", url, nil)
  15. if err != nil {
  16. glog.V(0).Infoln("failing to delete", url)
  17. return err
  18. }
  19. _, err = http.DefaultClient.Do(req)
  20. return err
  21. }