-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How does go client sdk create dir path in a bucket ? #3555
Comments
@goodforever we don't support directories on Minio. You can just upload and object with prefix parent dirs are automatically created. |
@harshavardhana i not quite understand what you said |
I am talking about
|
Not just |
From an SDK point of view package main
import (
"bytes"
"log"
minio "github.com/minio/minio-go"
)
func main() {
// Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-testfile, my-bucketname and
// my-objectname are dummy values, please replace them with original values.
// Requests are always secure (HTTPS) by default. Set secure=false to enable insecure (HTTP) access.
// This boolean value is the last argument for New().
// New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically
// determined based on the Endpoint value.
s3Client, err := minio.New("YOUR-SERVER:9000", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", true)
if err != nil {
log.Fatalln(err)
}
n, err := s3Client.PutObject("my-bucketname", "2/3/my/prefix/object", bytes.NewReader([]byte("Hello, World")), "application/octet-stream")
if err != nil {
log.Fatalln(err)
}
log.Println("Uploaded", "2/3/my/prefix/object", " of size: ", n, "Successfully.")
}
|
@goodforever here is the example package main
import (
"bytes"
"log"
minio "github.com/minio/minio-go"
)
func main() {
// Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-testfile, my-bucketname and
// my-objectname are dummy values, please replace them with original values.
// Requests are always secure (HTTPS) by default. Set secure=false to enable insecure (HTTP) access.
// This boolean value is the last argument for New().
// New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically
// determined based on the Endpoint value.
s3Client, err := minio.New("YOUR-SERVER:9000", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", true)
if err != nil {
log.Fatalln(err)
}
n, err := s3Client.PutObject("my-bucketname", "2/3/my/prefix/object", bytes.NewReader([]byte("Hello, World")), "application/octet-stream")
if err != nil {
log.Fatalln(err)
}
log.Println("Uploaded", "2/3/my/prefix/object", " of size: ", n, "Successfully.")
} Observe here '2/3/my/prefix' is the parent directory for the object named |
Thanks ,I just need this what you said. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
How does go client sdk create dir path in a bucket ?
The text was updated successfully, but these errors were encountered: