{"id":13367240,"url":"https://github.com/minio/minio-Go","last_synced_at":"2025-03-12T18:32:11.901Z","repository":{"id":31370083,"uuid":"34933072","full_name":"minio/minio-go","owner":"minio","description":"MinIO Go client SDK for S3 compatible object storage","archived":false,"fork":false,"pushed_at":"2024-04-26T21:20:47.000Z","size":6635,"stargazers_count":2264,"open_issues_count":16,"forks_count":609,"subscribers_count":48,"default_branch":"master","last_synced_at":"2024-04-29T16:32:34.681Z","etag":null,"topics":["aws-signature","client-sdk","cloud","fileuploader","go","libraries","minio","s3"],"latest_commit_sha":null,"homepage":"https://docs.min.io/docs/golang-client-quickstart-guide.html","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/minio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-05-02T02:36:46.000Z","updated_at":"2024-05-29T22:16:49.443Z","dependencies_parsed_at":"2023-12-05T23:24:55.494Z","dependency_job_id":"9bcaeb27-cf84-494f-83d7-242eba680ced","html_url":"https://github.com/minio/minio-go","commit_stats":{"total_commits":1314,"total_committers":168,"mean_commits":7.821428571428571,"dds":0.6636225266362252,"last_synced_commit":"e3ac1f2e706b07cc162026ad3bf56a6b127c59fa"},"previous_names":["minio/objectstorage-go","minio-io/objectstorage-go"],"tags_count":171,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minio%2Fminio-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minio%2Fminio-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minio%2Fminio-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minio%2Fminio-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/minio","download_url":"https://codeload.github.com/minio/minio-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243271543,"owners_count":20264473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-signature","client-sdk","cloud","fileuploader","go","libraries","minio","s3"],"created_at":"2024-07-30T00:01:42.304Z","updated_at":"2025-03-12T18:32:11.874Z","avatar_url":"https://github.com/minio.png","language":"Go","funding_links":[],"categories":["第三方 APIs"],"sub_categories":["高级控制台界面","高級控制台界面"],"readme":"# MinIO Go Client SDK for Amazon S3 Compatible Cloud Storage [![Slack](https://slack.min.io/slack?type=svg)](https://slack.min.io) [![Sourcegraph](https://sourcegraph.com/github.com/minio/minio-go/-/badge.svg)](https://sourcegraph.com/github.com/minio/minio-go?badge) [![Apache V2 License](https://img.shields.io/badge/license-Apache%20V2-blue.svg)](https://github.com/minio/minio-go/blob/master/LICENSE)\n\nThe MinIO Go Client SDK provides straightforward APIs to access any Amazon S3 compatible object storage.\n\nThis Quickstart Guide covers how to install the MinIO client SDK, connect to MinIO, and create a sample file uploader.\nFor a complete list of APIs and examples, see the [godoc documentation](https://pkg.go.dev/github.com/minio/minio-go/v7) or [Go Client API Reference](https://min.io/docs/minio/linux/developers/go/API.html).\n\nThese examples presume a working [Go development environment](https://golang.org/doc/install) and the [MinIO `mc` command line tool](https://min.io/docs/minio/linux/reference/minio-mc.html).\n\n## Download from Github\n\nFrom your project directory:\n\n```sh\ngo get github.com/minio/minio-go/v7\n```\n\n## Initialize a MinIO Client Object\n\nThe MinIO client requires the following parameters to connect to an Amazon S3 compatible object storage:\n\n| Parameter         | Description                                                |\n| ----------------- | ---------------------------------------------------------- |\n| `endpoint`        | URL to object storage service.                             |\n| `_minio.Options_` | All the options such as credentials, custom transport etc. |\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/minio/minio-go/v7\"\n\t\"github.com/minio/minio-go/v7/pkg/credentials\"\n)\n\nfunc main() {\n\tendpoint := \"play.min.io\"\n\taccessKeyID := \"Q3AM3UQ867SPQQA43P2F\"\n\tsecretAccessKey := \"zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG\"\n\tuseSSL := true\n\n\t// Initialize minio client object.\n\tminioClient, err := minio.New(endpoint, \u0026minio.Options{\n\t\tCreds:  credentials.NewStaticV4(accessKeyID, secretAccessKey, \"\"),\n\t\tSecure: useSSL,\n\t})\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tlog.Printf(\"%#v\\n\", minioClient) // minioClient is now set up\n}\n```\n\n## Example - File Uploader\n\nThis sample code connects to an object storage server, creates a bucket, and uploads a file to the bucket.\nIt uses the MinIO `play` server, a public MinIO cluster located at [https://play.min.io](https://play.min.io).\n\nThe `play` server runs the latest stable version of MinIO and may be used for testing and development.\nThe access credentials shown in this example are open to the public and all data uploaded to `play` should be considered public and non-protected.\n\n### FileUploader.go\n\nThis example does the following:\n\n- Connects to the MinIO `play` server using the provided credentials.\n- Creates a bucket named `testbucket`.\n- Uploads a file named `testdata` from `/tmp`.\n- Verifies the file was created using `mc ls`.\n\n```go\n// FileUploader.go MinIO example\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/minio/minio-go/v7\"\n\t\"github.com/minio/minio-go/v7/pkg/credentials\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tendpoint := \"play.min.io\"\n\taccessKeyID := \"Q3AM3UQ867SPQQA43P2F\"\n\tsecretAccessKey := \"zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG\"\n\tuseSSL := true\n\n\t// Initialize minio client object.\n\tminioClient, err := minio.New(endpoint, \u0026minio.Options{\n\t\tCreds:  credentials.NewStaticV4(accessKeyID, secretAccessKey, \"\"),\n\t\tSecure: useSSL,\n\t})\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\t// Make a new bucket called testbucket.\n\tbucketName := \"testbucket\"\n\tlocation := \"us-east-1\"\n\n\terr = minioClient.MakeBucket(ctx, bucketName, minio.MakeBucketOptions{Region: location})\n\tif err != nil {\n\t\t// Check to see if we already own this bucket (which happens if you run this twice)\n\t\texists, errBucketExists := minioClient.BucketExists(ctx, bucketName)\n\t\tif errBucketExists == nil \u0026\u0026 exists {\n\t\t\tlog.Printf(\"We already own %s\\n\", bucketName)\n\t\t} else {\n\t\t\tlog.Fatalln(err)\n\t\t}\n\t} else {\n\t\tlog.Printf(\"Successfully created %s\\n\", bucketName)\n\t}\n\n\t// Upload the test file\n\t// Change the value of filePath if the file is in another location\n\tobjectName := \"testdata\"\n\tfilePath := \"/tmp/testdata\"\n\tcontentType := \"application/octet-stream\"\n\n\t// Upload the test file with FPutObject\n\tinfo, err := minioClient.FPutObject(ctx, bucketName, objectName, filePath, minio.PutObjectOptions{ContentType: contentType})\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tlog.Printf(\"Successfully uploaded %s of size %d\\n\", objectName, info.Size)\n}\n```\n\n**1. Create a test file containing data:**\n\nYou can do this with `dd` on Linux or macOS systems:\n\n```sh\ndd if=/dev/urandom of=/tmp/testdata bs=2048 count=10\n```\n\nor `fsutil` on Windows:\n\n```sh\nfsutil file createnew \"C:\\Users\\\u003cusername\u003e\\Desktop\\sample.txt\" 20480\n```\n\n**2. Run FileUploader with the following commands:**\n\n```sh\ngo mod init example/FileUploader\ngo get github.com/minio/minio-go/v7\ngo get github.com/minio/minio-go/v7/pkg/credentials\ngo run FileUploader.go\n```\n\nThe output resembles the following:\n\n```sh\n2023/11/01 14:27:55 Successfully created testbucket\n2023/11/01 14:27:55 Successfully uploaded testdata of size 20480\n```\n\n**3. Verify the Uploaded File With `mc ls`:**\n\n```sh\nmc ls play/testbucket\n[2023-11-01 14:27:55 UTC]  20KiB STANDARD TestDataFile\n```\n\n## API Reference\n\nThe full API Reference is available here.\n\n* [Complete API Reference](https://min.io/docs/minio/linux/developers/go/API.html)\n\n### API Reference : Bucket Operations\n\n* [`MakeBucket`](https://min.io/docs/minio/linux/developers/go/API.html#MakeBucket)\n* [`ListBuckets`](https://min.io/docs/minio/linux/developers/go/API.html#ListBuckets)\n* [`BucketExists`](https://min.io/docs/minio/linux/developers/go/API.html#BucketExists)\n* [`RemoveBucket`](https://min.io/docs/minio/linux/developers/go/API.html#RemoveBucket)\n* [`ListObjects`](https://min.io/docs/minio/linux/developers/go/API.html#ListObjects)\n* [`ListIncompleteUploads`](https://min.io/docs/minio/linux/developers/go/API.html#ListIncompleteUploads)\n\n### API Reference : Bucket policy Operations\n\n* [`SetBucketPolicy`](https://min.io/docs/minio/linux/developers/go/API.html#SetBucketPolicy)\n* [`GetBucketPolicy`](https://min.io/docs/minio/linux/developers/go/API.html#GetBucketPolicy)\n\n### API Reference : Bucket notification Operations\n\n* [`SetBucketNotification`](https://min.io/docs/minio/linux/developers/go/API.html#SetBucketNotification)\n* [`GetBucketNotification`](https://min.io/docs/minio/linux/developers/go/API.html#GetBucketNotification)\n* [`RemoveAllBucketNotification`](https://min.io/docs/minio/linux/developers/go/API.html#RemoveAllBucketNotification)\n* [`ListenBucketNotification`](https://min.io/docs/minio/linux/developers/go/API.html#ListenBucketNotification) (MinIO Extension)\n* [`ListenNotification`](https://min.io/docs/minio/linux/developers/go/API.html#ListenNotification) (MinIO Extension)\n\n### API Reference : File Object Operations\n\n* [`FPutObject`](https://min.io/docs/minio/linux/developers/go/API.html#FPutObject)\n* [`FGetObject`](https://min.io/docs/minio/linux/developers/go/API.html#FGetObject)\n\n### API Reference : Object Operations\n\n* [`GetObject`](https://min.io/docs/minio/linux/developers/go/API.html#GetObject)\n* [`PutObject`](https://min.io/docs/minio/linux/developers/go/API.html#PutObject)\n* [`PutObjectStreaming`](https://min.io/docs/minio/linux/developers/go/API.html#PutObjectStreaming)\n* [`StatObject`](https://min.io/docs/minio/linux/developers/go/API.html#StatObject)\n* [`CopyObject`](https://min.io/docs/minio/linux/developers/go/API.html#CopyObject)\n* [`RemoveObject`](https://min.io/docs/minio/linux/developers/go/API.html#RemoveObject)\n* [`RemoveObjects`](https://min.io/docs/minio/linux/developers/go/API.html#RemoveObjects)\n* [`RemoveIncompleteUpload`](https://min.io/docs/minio/linux/developers/go/API.html#RemoveIncompleteUpload)\n* [`SelectObjectContent`](https://min.io/docs/minio/linux/developers/go/API.html#SelectObjectContent)\n\n### API Reference : Presigned Operations\n\n* [`PresignedGetObject`](https://min.io/docs/minio/linux/developers/go/API.html#PresignedGetObject)\n* [`PresignedPutObject`](https://min.io/docs/minio/linux/developers/go/API.html#PresignedPutObject)\n* [`PresignedHeadObject`](https://min.io/docs/minio/linux/developers/go/API.html#PresignedHeadObject)\n* [`PresignedPostPolicy`](https://min.io/docs/minio/linux/developers/go/API.html#PresignedPostPolicy)\n\n### API Reference : Client custom settings\n\n* [`SetAppInfo`](https://min.io/docs/minio/linux/developers/go/API.html#SetAppInfo)\n* [`TraceOn`](https://min.io/docs/minio/linux/developers/go/API.html#TraceOn)\n* [`TraceOff`](https://min.io/docs/minio/linux/developers/go/API.html#TraceOff)\n\n## Full Examples\n\n### Full Examples : Bucket Operations\n\n* [makebucket.go](https://github.com/minio/minio-go/blob/master/examples/s3/makebucket.go)\n* [listbuckets.go](https://github.com/minio/minio-go/blob/master/examples/s3/listbuckets.go)\n* [bucketexists.go](https://github.com/minio/minio-go/blob/master/examples/s3/bucketexists.go)\n* [removebucket.go](https://github.com/minio/minio-go/blob/master/examples/s3/removebucket.go)\n* [listobjects.go](https://github.com/minio/minio-go/blob/master/examples/s3/listobjects.go)\n* [listobjectsV2.go](https://github.com/minio/minio-go/blob/master/examples/s3/listobjectsV2.go)\n* [listincompleteuploads.go](https://github.com/minio/minio-go/blob/master/examples/s3/listincompleteuploads.go)\n\n### Full Examples : Bucket policy Operations\n\n* [setbucketpolicy.go](https://github.com/minio/minio-go/blob/master/examples/s3/setbucketpolicy.go)\n* [getbucketpolicy.go](https://github.com/minio/minio-go/blob/master/examples/s3/getbucketpolicy.go)\n* [listbucketpolicies.go](https://github.com/minio/minio-go/blob/master/examples/s3/listbucketpolicies.go)\n\n### Full Examples : Bucket lifecycle Operations\n\n* [setbucketlifecycle.go](https://github.com/minio/minio-go/blob/master/examples/s3/setbucketlifecycle.go)\n* [getbucketlifecycle.go](https://github.com/minio/minio-go/blob/master/examples/s3/getbucketlifecycle.go)\n\n### Full Examples : Bucket encryption Operations\n\n* [setbucketencryption.go](https://github.com/minio/minio-go/blob/master/examples/s3/setbucketencryption.go)\n* [getbucketencryption.go](https://github.com/minio/minio-go/blob/master/examples/s3/getbucketencryption.go)\n* [removebucketencryption.go](https://github.com/minio/minio-go/blob/master/examples/s3/removebucketencryption.go)\n\n### Full Examples : Bucket replication Operations\n\n* [setbucketreplication.go](https://github.com/minio/minio-go/blob/master/examples/s3/setbucketreplication.go)\n* [getbucketreplication.go](https://github.com/minio/minio-go/blob/master/examples/s3/getbucketreplication.go)\n* [removebucketreplication.go](https://github.com/minio/minio-go/blob/master/examples/s3/removebucketreplication.go)\n\n### Full Examples : Bucket notification Operations\n\n* [setbucketnotification.go](https://github.com/minio/minio-go/blob/master/examples/s3/setbucketnotification.go)\n* [getbucketnotification.go](https://github.com/minio/minio-go/blob/master/examples/s3/getbucketnotification.go)\n* [removeallbucketnotification.go](https://github.com/minio/minio-go/blob/master/examples/s3/removeallbucketnotification.go)\n* [listenbucketnotification.go](https://github.com/minio/minio-go/blob/master/examples/minio/listenbucketnotification.go) (MinIO Extension)\n* [listennotification.go](https://github.com/minio/minio-go/blob/master/examples/minio/listen-notification.go) (MinIO Extension)\n\n### Full Examples : File Object Operations\n\n* [fputobject.go](https://github.com/minio/minio-go/blob/master/examples/s3/fputobject.go)\n* [fgetobject.go](https://github.com/minio/minio-go/blob/master/examples/s3/fgetobject.go)\n\n### Full Examples : Object Operations\n\n* [putobject.go](https://github.com/minio/minio-go/blob/master/examples/s3/putobject.go)\n* [getobject.go](https://github.com/minio/minio-go/blob/master/examples/s3/getobject.go)\n* [statobject.go](https://github.com/minio/minio-go/blob/master/examples/s3/statobject.go)\n* [copyobject.go](https://github.com/minio/minio-go/blob/master/examples/s3/copyobject.go)\n* [removeobject.go](https://github.com/minio/minio-go/blob/master/examples/s3/removeobject.go)\n* [removeincompleteupload.go](https://github.com/minio/minio-go/blob/master/examples/s3/removeincompleteupload.go)\n* [removeobjects.go](https://github.com/minio/minio-go/blob/master/examples/s3/removeobjects.go)\n\n### Full Examples : Encrypted Object Operations\n\n* [put-encrypted-object.go](https://github.com/minio/minio-go/blob/master/examples/s3/put-encrypted-object.go)\n* [get-encrypted-object.go](https://github.com/minio/minio-go/blob/master/examples/s3/get-encrypted-object.go)\n* [fput-encrypted-object.go](https://github.com/minio/minio-go/blob/master/examples/s3/fputencrypted-object.go)\n\n### Full Examples : Presigned Operations\n\n* [presignedgetobject.go](https://github.com/minio/minio-go/blob/master/examples/s3/presignedgetobject.go)\n* [presignedputobject.go](https://github.com/minio/minio-go/blob/master/examples/s3/presignedputobject.go)\n* [presignedheadobject.go](https://github.com/minio/minio-go/blob/master/examples/s3/presignedheadobject.go)\n* [presignedpostpolicy.go](https://github.com/minio/minio-go/blob/master/examples/s3/presignedpostpolicy.go)\n\n## Explore Further\n\n* [Godoc Documentation](https://pkg.go.dev/github.com/minio/minio-go/v7)\n* [Complete Documentation](https://min.io/docs/minio/kubernetes/upstream/index.html)\n* [MinIO Go Client SDK API Reference](https://min.io/docs/minio/linux/developers/go/API.html)\n\n## Contribute\n\n[Contributors Guide](https://github.com/minio/minio-go/blob/master/CONTRIBUTING.md)\n\n## License\n\nThis SDK is distributed under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0), see [LICENSE](https://github.com/minio/minio-go/blob/master/LICENSE) and [NOTICE](https://github.com/minio/minio-go/blob/master/NOTICE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminio%2Fminio-Go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fminio%2Fminio-Go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminio%2Fminio-Go/lists"}