Comparing version 3.2.1 to 3.2.2
@@ -94,14 +94,16 @@ /* | ||
// Calculate the md5sum. | ||
var md5 = _crypto2['default'].createHash('md5'); | ||
md5.update(chunk); | ||
var md5sum = md5.digest(); | ||
var method = 'PUT'; | ||
var headers = { | ||
'Content-Length': chunk.length, | ||
'Content-Type': this.contentType, | ||
'Content-MD5': md5sum.toString('base64') | ||
'Content-Type': this.contentType | ||
}; | ||
var md5digest = ''; | ||
// Calculate and set Content-MD5 header if SHA256 is not set. | ||
// This will happen only when there is a secure connection to the s3 server. | ||
if (!this.client.enableSHA256) { | ||
md5digest = _crypto2['default'].createHash('md5').update(chunk).digest(); | ||
headers['Content-MD5'] = md5digest.toString('base64'); | ||
} | ||
// We can flush the object in one packet if it fits in one chunk. This is true | ||
@@ -200,3 +202,8 @@ // if the chunk size is smaller than the part size, signifying the end of the | ||
if (oldPart && md5sum.toString('hex') === oldPart.etag) { | ||
//Calulcate the md5 hash, if it has not already been calculated. | ||
if (!md5digest) { | ||
md5digest = _crypto2['default'].createHash('md5').update(chunk).digest(); | ||
} | ||
if (oldPart && md5digest.toString('hex') === oldPart.etag) { | ||
// The md5 matches, the chunk has already been uploaded. | ||
@@ -203,0 +210,0 @@ this.etags.push({ part: partNumber, etag: oldPart.etag }); |
@@ -175,9 +175,17 @@ /* | ||
return _through22['default'].obj(function (chunk, enc, cb) { | ||
md5.update(chunk); | ||
if (enableSHA256) sha256.update(chunk); | ||
if (enableSHA256) { | ||
sha256.update(chunk); | ||
} else { | ||
md5.update(chunk); | ||
} | ||
cb(); | ||
}, function (cb) { | ||
var md5sum = md5.digest('base64'); | ||
var md5sum = ''; | ||
var sha256sum = ''; | ||
if (enableSHA256) sha256sum = sha256.digest('hex'); | ||
if (enableSHA256) { | ||
sha256sum = sha256.digest('hex'); | ||
} else { | ||
md5sum = md5.digest('base64'); | ||
} | ||
var hashData = { md5sum: md5sum, sha256sum: sha256sum }; | ||
@@ -184,0 +192,0 @@ this.push(hashData); |
@@ -32,6 +32,6 @@ # JavaScript Client API Reference [![Slack](https://slack.minio.io/slack?type=svg)](https://slack.minio.io) | ||
| ------------- |-------------| -----| ----- | | ||
| [`makeBucket`](#makeBucket) | [`getObject`](#getObject) | [`presignedGetObject`](#presignedGetObject) | [`getBucketNotification`](#getBucketNotification) | | ||
| [`listBuckets`](#listBuckets) | [`getPartialObject`](#getPartialObject) | [`presignedPutObject`](#presignedPutObject) | [`setBucketNotification`](#setBucketNotification) | | ||
| [`bucketExists`](#bucketExists) | [`fGetObject`](#fGetObject) | [`presignedPostPolicy`](#presignedPostPolicy) | [`removeAllBucketNotification`](#removeAllBucketNotification) | | ||
| [`removeBucket`](#removeBucket) | [`putObject`](#putObject) | | [`getBucketPolicy`](#getBucketPolicy) | | | ||
| [`makeBucket`](#makeBucket) | [`getObject`](#getObject) | [`presignedUrl`](#presignedUrl) | [`getBucketNotification`](#getBucketNotification) | | ||
| [`listBuckets`](#listBuckets) | [`getPartialObject`](#getPartialObject) | [`presignedGetObject`](#presignedGetObject) | [`setBucketNotification`](#setBucketNotification) | | ||
| [`bucketExists`](#bucketExists) | [`fGetObject`](#fGetObject) | [`presignedPutObject`](#presignedPutObject) | [`removeAllBucketNotification`](#removeAllBucketNotification) | | ||
| [`removeBucket`](#removeBucket) | [`putObject`](#putObject) | [`presignedPostPolicy`](#presignedPostPolicy) | [`getBucketPolicy`](#getBucketPolicy) | | | ||
| [`listObjects`](#listObjects) | [`fPutObject`](#fPutObject) | | [`setBucketPolicy`](#setBucketPolicy) | ||
@@ -353,5 +353,5 @@ | [`listObjectsV2`](#listObjectsV2) | [`copyObject`](#copyObject) | | [`listenBucketNotification`](#listenBucketNotification)| | ||
|---|---|---| | ||
| `bucketName` | _string_ | Name of the bucket. | | ||
| `objectName` | _string_ | Name of the object. | | ||
| `callback(err, stream)` | _function_ | Callback is called with `err` in case of error. `stream` is the object content stream. If no callback is passed, a `Promise` is returned. | | ||
|`bucketName` | _string_ | Name of the bucket. | | ||
|`objectName` | _string_ | Name of the object. | | ||
|`callback(err, stream)` | _function_ | Callback is called with `err` in case of error. `stream` is the object content stream. If no callback is passed, a `Promise` is returned. | | ||
@@ -658,6 +658,51 @@ __Example__ | ||
<a name="presignedUrl"></a> | ||
### presignedUrl(httpMethod, bucketName, objectName, expiry[, reqParams, cb]) | ||
Generates a presigned URL for the provided HTTP method, 'httpMethod'. Browsers/Mobile clients may point to this URL to directly download objects even if the bucket is private. This presigned URL can have an associated expiration time in seconds after which the URL is no longer valid. The default value is 7 days. | ||
__Parameters__ | ||
| Param | Type | Description | | ||
|---|---|---| | ||
|`bucketName` | _string_ | Name of the bucket. | | ||
|`objectName` | _string_ | Name of the object. | | ||
|`expiry` | _number_ | Expiry time in seconds. Default value is 7 days. | | ||
|`reqParams` | _object_ | request parameters. | | ||
|`callback(err, presignedUrl)` | _function_ | Callback function is called with non `null` err value in case of error. `presignedUrl` will be the URL using which the object can be downloaded using GET request. If no callback is passed, a `Promise` is returned. | | ||
__Example 1__ | ||
```js | ||
// presigned url for 'getObject' method. | ||
// expires in a day. | ||
minioClient.presignedUrl('GET', 'mybucket', 'hello.txt', 24*60*60, function(err, presignedUrl) { | ||
if (err) return console.log(err) | ||
console.log(presignedUrl) | ||
}) | ||
``` | ||
__Example 2__ | ||
```js | ||
// presigned url for 'listObject' method. | ||
// Lists objects in 'myBucket' with prefix 'data'. | ||
// Lists max 1000 of them. | ||
minioClient.presignedUrl('GET', 'mybucket', '', 1000, {'prefix': 'data', 'max-keys': 1000}, function(err, presignedUrl) { | ||
if (err) return console.log(err) | ||
console.log(presignedUrl) | ||
}) | ||
``` | ||
<a name="presignedGetObject"></a> | ||
### presignedGetObject(bucketName, objectName, expiry[, cb]) | ||
Generates a presigned URL for HTTP GET operations. Browsers/Mobile clients may point to this URL to directly download objects even if the bucket is private. This presigned URL can have an associated expiration time in seconds after which the URL is no longer valid. The default expiry is set to 7 days. | ||
Generates a presigned URL for HTTP GET operations. Browsers/Mobile clients may point to this URL to directly download objects even if the bucket is private. This presigned URL can have an associated expiration time in seconds after which the URL is no longer valid. The default value is 7 days. | ||
@@ -671,6 +716,6 @@ | ||
|---|---|---| | ||
| `bucketName` | _string_ | Name of the bucket. | | ||
|`objectName` | _string_ | Name of the object. | | ||
| `expiry` |_number_ | Expiry in seconds. Default expiry is set to 7 days. | | ||
| `callback(err, presignedUrl)` | _function_ | Callback function is called with non `null` err value in case of error. `presignedUrl` will be the URL using which the object can be downloaded using GET request. If no callback is passed, a `Promise` is returned. | | ||
|`bucketName` | _string_ | Name of the bucket. | | ||
|`objectName` | _string_ | Name of the object. | | ||
|`expiry` | _number_ | Expiry time in seconds. Default value is 7 days. | | ||
|`callback(err, presignedUrl)` | _function_ | Callback function is called with non `null` err value in case of error. `presignedUrl` will be the URL using which the object can be downloaded using GET request. If no callback is passed, a `Promise` is returned. | | ||
@@ -692,3 +737,3 @@ | ||
Generates a presigned URL for HTTP PUT operations. Browsers/Mobile clients may point to this URL to upload objects directly to a bucket even if it is private. This presigned URL can have an associated expiration time in seconds after which the URL is no longer valid. The default expiry is set to 7 days. | ||
Generates a presigned URL for HTTP PUT operations. Browsers/Mobile clients may point to this URL to upload objects directly to a bucket even if it is private. This presigned URL can have an associated expiration time in seconds after which the URL is no longer valid. The default value is 7 days. | ||
@@ -701,6 +746,6 @@ | ||
|---|---|---| | ||
| `bucketName` | _string_ | Name of the bucket. | | ||
| `objectName` | _string_ | Name of the object. | | ||
| `expiry` | _number_ | Expiry in seconds. Default expiry is set to 7 days. | | ||
| `callback(err, presignedUrl)` | _function_ | Callback function is called with non `null` err value in case of error. `presignedUrl` will be the URL using which the object can be uploaded using PUT request. If no callback is passed, a `Promise` is returned. | | ||
|`bucketName` | _string_ | Name of the bucket. | | ||
|`objectName` | _string_ | Name of the object. | | ||
|`expiry` | _number_ | Expiry time in seconds. Default value is 7 days. | | ||
|`callback(err, presignedUrl)` | _function_ | Callback function is called with non `null` err value in case of error. `presignedUrl` will be the URL using which the object can be uploaded using PUT request. If no callback is passed, a `Promise` is returned. | | ||
@@ -707,0 +752,0 @@ |
@@ -45,3 +45,3 @@ # For maintainers only | ||
``` | ||
$ export GNUPGHOME=/media/${USER}/Minio2/trusted | ||
$ export GNUPGHOME=/media/${USER}/minio/trusted | ||
$ git tag -s 3.2.1 | ||
@@ -48,0 +48,0 @@ $ git push |
{ | ||
"name": "minio", | ||
"version": "3.2.1", | ||
"version": "3.2.2", | ||
"description": "S3 Compatible Cloud Storage client", | ||
@@ -44,3 +44,4 @@ "main": "./dist/main/minio.js", | ||
"xml": "^1.0.0", | ||
"xml2js": "^0.4.15" | ||
"xml2js": "^0.4.15", | ||
"querystring": "0.2.0" | ||
}, | ||
@@ -47,0 +48,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
519234
14
5019
+ Addedquerystring@0.2.0
+ Addedquerystring@0.2.0(transitive)