Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

adding compressiong support!

[email protected]50c3f1d4a71f
diff --git a/weed-fs/src/pkg/storage/needle.go b/weed-fs/src/pkg/storage/needle.go
index b0d499c056..6396b8ef03 100644
--- a/weed-fs/src/pkg/storage/needle.go
+++ b/weed-fs/src/pkg/storage/needle.go
@@ -5,7 +5,7 @@ import (
"io"
"io/ioutil"
"log"
- "mime"
+ "mime"
"net/http"
"os"
"pkg/util"
@@ -32,17 +32,17 @@ func NewNeedle(r *http.Request) (n *Needle, e error) {
return
}
part, _ := form.NextPart()
- fname := part.FileName()
- data, _ := ioutil.ReadAll(part)
- //log.Println("uploading file " + part.FileName())
- dotIndex := strings.LastIndex(fname, ".")
- if dotIndex > 0 {
- ext := fname[dotIndex:]
- mtype := mime.TypeByExtension(ext)
- if IsCompressable(ext, mtype){
- data = GzipData(data)
- }
- }
+ fname := part.FileName()
+ data, _ := ioutil.ReadAll(part)
+ //log.Println("uploading file " + part.FileName())
+ dotIndex := strings.LastIndex(fname, ".")
+ if dotIndex > 0 {
+ ext := fname[dotIndex:]
+ mtype := mime.TypeByExtension(ext)
+ if IsCompressable(ext, mtype) {
+ data = GzipData(data)
+ }
+ }
n.Data = data
commaSep := strings.LastIndex(r.URL.Path, ",")