Skip to content

Commit

Permalink
translate minio-js docs to Chinese. (#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
dingjs authored and deekoder committed Dec 19, 2017
1 parent 3824033 commit 01fa7be
Show file tree
Hide file tree
Showing 3 changed files with 1,223 additions and 0 deletions.
197 changes: 197 additions & 0 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
# 适用于Amazon S3兼容云存储的Minio JavaScript Library [![Slack](https://slack.minio.io/slack?type=svg)](https://slack.minio.io)

[![NPM](https://nodei.co/npm/minio.png)](https://nodei.co/npm/minio/)

Minio JavaScript Client SDK提供简单的API来访问任何Amazon S3兼容的对象存储服务。

本快速入门指南将向您展示如何安装客户端SDK并执行示例JavaScript程序。有关API和示例的完整列表,请参阅[JavaScript客户端API参考](https://docs.minio.io/docs/javascript-client-api-reference)文档。

本文假设你已经安装了[nodejs](http://nodejs.org/)

## 使用NPM下载

```sh
npm install --save minio
```

## 下载并安装源码

```sh
git clone https://github.com/minio/minio-js
cd minio-js
npm install
npm install -g
```

## 初使化Minio Client

你需要设置5个属性来链接Minio对象存储服务。

| 参数 | 描述 |
| :------- | :------------ |
| endPoint |对象存储服务的URL |
|port| TCP/IP端口号。可选值,如果是使用HTTP的话,默认值是`80`;如果使用HTTPS的话,默认值是`443`|
| accessKey | Access key是唯一标识你的账户的用户ID。 |
| secretKey | Secret key是你账户的密码。 |
|secure |true代表使用HTTPS |


```js
var Minio = require('minio')

var minioClient = new Minio.Client({
endPoint: 'play.minio.io',
port: 9000,
secure: true,
accessKey: 'Q3AM3UQ867SPQQA43P2F',
secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG'
});
```

## 示例-文件上传

本示例连接到一个对象存储服务,创建一个存储桶并上传一个文件到存储桶中。

我们在本示例中使用运行在 [https://play.minio.io:9000](https://play.minio.io:9000) 上的Minio服务,你可以用这个服务来开发和测试。示例中的访问凭据是公开的。

#### file-uploader.js

```js
var Minio = require('minio')

// Instantiate the minio client with the endpoint
// and access keys as shown below.
var minioClient = new Minio.Client({
endPoint: 'play.minio.io',
port: 9000,
secure: true,
accessKey: 'Q3AM3UQ867SPQQA43P2F',
secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG'
});

// File that needs to be uploaded.
var file = '/tmp/photos-europe.tar'

// Make a bucket called europetrip.
minioClient.makeBucket('europetrip', 'us-east-1', function(err) {
if (err) return console.log(err)

console.log('Bucket created successfully in "us-east-1".')

// Using fPutObject API upload your file to the bucket europetrip.
minioClient.fPutObject('europetrip', 'photos-europe.tar', file, 'application/octet-stream', function(err, etag) {
if (err) return console.log(err)
console.log('File uploaded successfully.')
});
});
```

#### 运行file-uploader

```sh
node file-uploader.js
Bucket created successfully in "us-east-1".

mc ls play/europetrip/
[2016-05-25 23:49:50 PDT] 17MiB photos-europe.tar
```

## API文档

完整的API文档在这里。
* [完整API文档](https://docs.minio.io/docs/javascript-client-api-reference)

### API文档 : 操作存储桶

* [`makeBucket`](https://docs.minio.io/docs/javascript-client-api-reference#makeBucket)
* [`listBuckets`](https://docs.minio.io/docs/javascript-client-api-reference#listBuckets)
* [`bucketExists`](https://docs.minio.io/docs/javascript-client-api-reference#bucketExists)
* [`removeBucket`](https://docs.minio.io/docs/javascript-client-api-reference#removeBucket)
* [`listObjects`](https://docs.minio.io/docs/javascript-client-api-reference#listObjects)
* [`listObjectsV2`](https://docs.minio.io/docs/javascript-client-api-reference#listObjectsV2)
* [`listIncompleteUploads`](https://docs.minio.io/docs/javascript-client-api-reference#listIncompleteUploads)

### API文档 : 操作文件对象

* [`fPutObject`](https://docs.minio.io/docs/javascript-client-api-reference#fPutObject)
* [`fGetObject`](https://docs.minio.io/docs/javascript-client-api-reference#fGetObject)

### API文档 : 操作对象

* [`getObject`](https://docs.minio.io/docs/javascript-client-api-reference#getObject)
* [`putObject`](https://docs.minio.io/docs/javascript-client-api-reference#putObject)
* [`copyObject`](https://docs.minio.io/docs/javascript-client-api-reference#copyObject)
* [`statObject`](https://docs.minio.io/docs/javascript-client-api-reference#statObject)
* [`removeObject`](https://docs.minio.io/docs/javascript-client-api-reference#removeObject)
* [`removeIncompleteUpload`](https://docs.minio.io/docs/javascript-client-api-reference#removeIncompleteUpload)

### API文档 : Presigned操作

* [`presignedGetObject`](https://docs.minio.io/docs/javascript-client-api-reference#presignedGetObject)
* [`presignedPutObject`](https://docs.minio.io/docs/javascript-client-api-reference#presignedPutObject)
* [`presignedPostPolicy`](https://docs.minio.io/docs/javascript-client-api-reference#presignedPostPolicy)

### API文档 : 存储桶通知

* [`getBucketNotification`](https://docs.minio.io/docs/javascript-client-api-reference#getBucketNotification)
* [`setBucketNotification`](https://docs.minio.io/docs/javascript-client-api-reference#setBucketNotification)
* [`removeAllBucketNotification`](https://docs.minio.io/docs/javascript-client-api-reference#removeAllBucketNotification)
* [`listenBucketNotification`](https://docs.minio.io/docs/javascript-client-api-reference#listenBucketNotification) (Minio Extension)

### API文档 : 存储桶策略

* [`getBucketPolicy`](https://docs.minio.io/docs/javascript-client-api-reference#getBucketPolicy)
* [`setBucketPolicy`](https://docs.minio.io/docs/javascript-client-api-reference#setBucketPolicy)


## 完整示例

#### 完整示例 : 操作存储桶

* [list-buckets.js](https://github.com/minio/minio-js/blob/master/examples/list-buckets.js)
* [list-objects.js](https://github.com/minio/minio-js/blob/master/examples/list-objects.js)
* [list-objects-v2.js](https://github.com/minio/minio-js/blob/master/examples/list-objects-v2.js)
* [bucket-exists.js](https://github.com/minio/minio-js/blob/master/examples/bucket-exists.js)
* [make-bucket.js](https://github.com/minio/minio-js/blob/master/examples/make-bucket.js)
* [remove-bucket.js](https://github.com/minio/minio-js/blob/master/examples/remove-bucket.js)
* [list-incomplete-uploads.js](https://github.com/minio/minio-js/blob/master/examples/list-incomplete-uploads.js)

#### 完整示例 : 操作文件对象
* [fput-object.js](https://github.com/minio/minio-js/blob/master/examples/fput-object.js)
* [fget-object.js](https://github.com/minio/minio-js/blob/master/examples/fget-object.js)

#### 完整示例 : 操作对象
* [put-object.js](https://github.com/minio/minio-js/blob/master/examples/put-object.js)
* [get-object.js](https://github.com/minio/minio-js/blob/master/examples/get-object.js)
* [copy-object.js](https://github.com/minio/minio-js/blob/master/examples/copy-object.js)
* [get-partialobject.js](https://github.com/minio/minio-js/blob/master/examples/get-partialobject.js)
* [remove-object.js](https://github.com/minio/minio-js/blob/master/examples/remove-object.js)
* [remove-incomplete-upload.js](https://github.com/minio/minio-js/blob/master/examples/remove-incomplete-upload.js)
* [stat-object.js](https://github.com/minio/minio-js/blob/master/examples/stat-object.js)

#### 完整示例 : Presigned操作
* [presigned-getobject.js](https://github.com/minio/minio-js/blob/master/examples/presigned-getobject.js)
* [presigned-putobject.js](https://github.com/minio/minio-js/blob/master/examples/presigned-putobject.js)
* [presigned-postpolicy.js](https://github.com/minio/minio-js/blob/master/examples/presigned-postpolicy.js)

####完整示例 : 存储桶通知
* [get-bucket-notification.js](https://github.com/minio/minio-js/blob/master/examples/get-bucket-notification.js)
* [set-bucket-notification.js](https://github.com/minio/minio-js/blob/master/examples/set-bucket-notification.js)
* [remove-all-bucket-notification.js](https://github.com/minio/minio-js/blob/master/examples/remove-all-bucket-notification.js)
* [listen-bucket-notification.js](https://github.com/minio/minio-js/blob/master/examples/minio/listen-bucket-notification.js) (Minio Extension)

#### 完整示例 : 存储桶策略
* [get-bucket-policy.js](https://github.com/minio/minio-js/blob/master/examples/get-bucket-policy.js)
* [set-bucket-policy.js](https://github.com/minio/minio-js/blob/master/examples/set-bucket-policy.js)

## 了解更多
* [完整文档](https://docs.minio.io)
* [Minio JavaScript Client SDK API文档](https://docs.minio.io/docs/javascript-client-api-reference)
* [创建属于你的购物APP-完整示例](https://docs.minio.io/docs/javascript-shopping-app)

## 贡献

[贡献者指南](https://github.com/minio/minio-js/blob/master/CONTRIBUTING.md)

[![Build Status](https://travis-ci.org/minio/minio-js.svg)](https://travis-ci.org/minio/minio-js)
[![Build status](https://ci.appveyor.com/api/projects/status/1d05e6nvxcelmrak?svg=true)](https://ci.appveyor.com/project/harshavardhana/minio-js)
Loading

0 comments on commit 01fa7be

Please sign in to comment.