Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

minio

Package Overview
Dependencies
Maintainers
4
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minio - npm Package Compare versions

Comparing version 3.1.3 to 3.2.0

.eslintrc.yml

2

dist/main/bucket-policy.js

@@ -121,3 +121,3 @@ /*

if (!isValidBucketPolicy(policy)) {
throw new errors.InvalidBucketPolicyError('Invalid bucket policy: ' + bucketPolicy + '(must be \'none\', \'readonly\', \'writeonly\', or \'readwrite\')');
throw new errors.InvalidBucketPolicyError('Invalid bucket policy: ' + policy + '(must be \'none\', \'readonly\', \'writeonly\', or \'readwrite\')');
}

@@ -124,0 +124,0 @@

@@ -22,2 +22,4 @@ /*

});
var _slice = Array.prototype.slice;
exports.promisify = promisify;
exports.uriEscape = uriEscape;

@@ -43,3 +45,4 @@ exports.uriResourceEscape = uriResourceEscape;

exports.isArray = isArray;
exports.isDate = isDate;
exports.makeDateLong = makeDateLong;
exports.makeDateShort = makeDateShort;
exports.pipesetup = pipesetup;

@@ -58,6 +61,33 @@ exports.readableStream = readableStream;

var _lodash = require('lodash');
// Returns a wrapper function that will promisify a given callback function.
// It will preserve 'this'.
var _lodash2 = _interopRequireDefault(_lodash);
function promisify(fn) {
return function () {
var _this = this;
// If the last argument is a function, assume its the callback.
var callback = arguments[arguments.length - 1];
// If the callback is given, don't promisify, just pass straight in.
if (typeof callback === 'function') return fn.apply(this, arguments);
// Otherwise, create a new set of arguments, and wrap
// it in a promise.
var args = [].concat(_slice.call(arguments));
return new Promise(function (resolve, reject) {
// Add the callback function.
args.push(function (err, value) {
if (err) return reject(err);
resolve(value);
});
// Call the function with our special adaptor callback added.
fn.apply(_this, args);
});
};
}
// All characters in string which are NOT unreserved should be percent encoded.

@@ -93,3 +123,3 @@ // Unreserved characers are : ALPHA / DIGIT / "-" / "." / "_" / "~"

function getScope(region, date) {
return date.format('YYYYMMDD') + '/' + region + '/s3/aws4_request';
return makeDateShort(date) + '/' + region + '/s3/aws4_request';
}

@@ -158,3 +188,3 @@

}
var alphaNumerics = '`~!@#$%^&*()+={}[]|\\\"\';:><?/'.split('');
var alphaNumerics = '`~!@#$%^&*()+={}[]|\\"\';:><?/'.split('');
// All non alphanumeric characters are invalid.

@@ -279,8 +309,26 @@ for (var i in alphaNumerics) {

// check if arg is Date
// Create a Date string with format:
// 'YYYYMMDDTHHmmss' + Z
function isDate(arg) {
return arg._isAMomentObject;
function makeDateLong(date) {
date = date || new Date();
// Gives format like: '2017-08-07T16:28:59.889Z'
date = date.toISOString();
return date.substr(0, 4) + date.substr(5, 2) + date.substr(8, 5) + date.substr(14, 2) + date.substr(17, 2) + 'Z';
}
// Create a Date string with format:
// 'YYYYMMDD'
function makeDateShort(date) {
date = date || new Date();
// Gives format like: '2017-08-07T16:28:59.889Z'
date = date.toISOString();
return date.substr(0, 4) + date.substr(5, 2) + date.substr(8, 2);
}
// pipesetup sets up pipe() from left to right os streams array

@@ -287,0 +335,0 @@ // pipesetup will also make sure that error emitted at any of the upstream Stream

@@ -29,4 +29,2 @@ /*

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

@@ -36,6 +34,2 @@

var _querystring = require('querystring');
var _querystring2 = _interopRequireDefault(_querystring);
var _events = require('events');

@@ -42,0 +36,0 @@

@@ -29,2 +29,4 @@ /*

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

@@ -38,2 +40,4 @@

var _crypto2 = _interopRequireDefault(_crypto);
var _querystring = require('querystring');

@@ -92,4 +96,4 @@

// Calculate the md5 sum.
var md5 = new _crypto.Hash('md5');
// Calculate the md5sum.
var md5 = _crypto2['default'].createHash('md5');
md5.update(chunk);

@@ -122,3 +126,3 @@ var md5sum = md5.digest();

if (etag) {
etag = etag.replace(/^\"/, '').replace(/\"$/, '');
etag = etag.replace(/^"/, '').replace(/"$/, '');
}

@@ -225,3 +229,3 @@

var etag = response.headers.etag;
if (etag) etag = etag.replace(/^\"/, '').replace(/\"$/, '');
if (etag) etag = etag.replace(/^"/, '').replace(/"$/, '');

@@ -228,0 +232,0 @@ _this.etags.push({ part: partNumber, etag: etag });

@@ -30,6 +30,2 @@ /*

var _moment = require('moment');
var _moment2 = _interopRequireDefault(_moment);
var _crypto = require('crypto');

@@ -167,3 +163,3 @@

}
var dateLine = date.format('YYYYMMDD'),
var dateLine = (0, _helpersJs.makeDateShort)(date),
hmac1 = _crypto2['default'].createHmac('sha256', 'AWS4' + secretKey).update(dateLine).digest(),

@@ -190,3 +186,3 @@ hmac2 = _crypto2['default'].createHmac('sha256', hmac1).update(region).digest(),

stringToSign.push(signV4Algorithm);
stringToSign.push(requestDate.format('YYYYMMDDTHHmmss') + 'Z');
stringToSign.push((0, _helpersJs.makeDateLong)(requestDate));
stringToSign.push(scope);

@@ -218,3 +214,3 @@ stringToSign.push(hash);

function signV4(request, accessKey, secretKey, region) {
function signV4(request, accessKey, secretKey, region, requestDate) {
if (!(0, _helpersJs.isObject)(request)) {

@@ -240,3 +236,2 @@ throw new TypeError('request should be of type "object"');

var requestDate = (0, _moment2['default'])(request.headers['x-amz-date'], 'YYYYMMDDTHHmmss');
var sha256sum = request.headers['x-amz-content-sha256'];

@@ -269,5 +264,2 @@

}
if (!(0, _helpersJs.isDate)(requestDate)) {
throw new TypeError('requestDate should be of type "Date"');
}

@@ -291,3 +283,3 @@ if (!accessKey) {

var iso8601Date = requestDate.format('YYYYMMDDTHHmmss') + 'Z';
var iso8601Date = (0, _helpersJs.makeDateLong)(requestDate);
var signedHeaders = getSignedHeaders(request.headers);

@@ -294,0 +286,0 @@ var credential = getCredential(accessKey, region, requestDate);

@@ -46,4 +46,2 @@ /*

var _bucketPolicyJs = require('./bucket-policy.js');
var _lodash = require('lodash');

@@ -50,0 +48,0 @@

@@ -38,10 +38,2 @@ /*

var _util = require('util');
var _util2 = _interopRequireDefault(_util);
var _concatStream = require('concat-stream');
var _concatStream2 = _interopRequireDefault(_concatStream);
var _xml2js = require('xml2js');

@@ -113,3 +105,3 @@

var xmlobj = parseXml(xml);
if (xmlobj.ETag) result.etag = xmlobj.ETag[0].replace(/^\"/g, '').replace(/\"$/g, '').replace(/^&quot;/g, '').replace(/&quot;$/g, '').replace(/^&#34;/g, '').replace(/^&#34;$/g, '');
if (xmlobj.ETag) result.etag = xmlobj.ETag[0].replace(/^"/g, '').replace(/"$/g, '').replace(/^&quot;/g, '').replace(/&quot;$/g, '').replace(/^&#34;/g, '').replace(/^&#34;$/g, '');
if (xmlobj.LastModified) result.lastModified = new Date(xmlobj.LastModified[0]);

@@ -250,3 +242,3 @@

var lastModified = new Date(p.LastModified[0]);
var etag = p.ETag[0].replace(/^\"/g, '').replace(/\"$/g, '').replace(/^&quot;/g, '').replace(/&quot;$/g, '').replace(/^&#34;/g, '').replace(/^&#34;$/g, '');
var etag = p.ETag[0].replace(/^"/g, '').replace(/"$/g, '').replace(/^&quot;/g, '').replace(/&quot;$/g, '').replace(/^&#34;/g, '').replace(/^&#34;$/g, '');
result.parts.push({ part: part, lastModified: lastModified, etag: etag });

@@ -274,3 +266,3 @@ });

var key = xmlobj.Key[0];
var etag = xmlobj.ETag[0].replace(/^\"/g, '').replace(/\"$/g, '').replace(/^&quot;/g, '').replace(/&quot;$/g, '').replace(/^&#34;/g, '').replace(/^&#34;$/g, '');
var etag = xmlobj.ETag[0].replace(/^"/g, '').replace(/"$/g, '').replace(/^&quot;/g, '').replace(/&quot;$/g, '').replace(/^&#34;/g, '').replace(/^&#34;$/g, '');

@@ -301,3 +293,3 @@ return { location: location, bucket: bucket, key: key, etag: etag };

var lastModified = new Date(content.LastModified[0]);
var etag = content.ETag[0].replace(/^\"/g, '').replace(/\"$/g, '').replace(/^&quot;/g, '').replace(/&quot;$/g, '').replace(/^&#34;/g, '').replace(/^&#34;$/g, '');
var etag = content.ETag[0].replace(/^"/g, '').replace(/"$/g, '').replace(/^&quot;/g, '').replace(/&quot;$/g, '').replace(/^&#34;/g, '').replace(/^&#34;$/g, '');
var size = +content.Size[0];

@@ -328,3 +320,2 @@ result.objects.push({ name: name, lastModified: lastModified, etag: etag, size: size });

};
var nextMarker;
var xmlobj = parseXml(xml);

@@ -338,3 +329,3 @@ if (xmlobj.IsTruncated && xmlobj.IsTruncated[0] === 'true') result.isTruncated = true;

var lastModified = new Date(content.LastModified[0]);
var etag = content.ETag[0].replace(/^\"/g, '').replace(/\"$/g, '').replace(/^&quot;/g, '').replace(/&quot;$/g, '').replace(/^&#34;/g, '').replace(/^&#34;$/g, '');
var etag = content.ETag[0].replace(/^"/g, '').replace(/"$/g, '').replace(/^&quot;/g, '').replace(/&quot;$/g, '').replace(/^&#34;/g, '').replace(/^&#34;$/g, '');
var size = +content.Size[0];

@@ -341,0 +332,0 @@ result.objects.push({ name: name, lastModified: lastModified, etag: etag, size: size });

@@ -8,3 +8,2 @@ # JavaScript Client API Reference [![Slack](https://slack.minio.io/slack?type=svg)](https://slack.minio.io)

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

@@ -19,3 +18,2 @@

});
```

@@ -26,3 +24,2 @@

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

@@ -35,3 +32,2 @@

})
```

@@ -66,11 +62,7 @@ | Bucket operations | Object operations | Presigned operations | Bucket Policy & Notification operations |

|---|---|---|
| `endPoint` | _string_ | endPoint is an URL, domain name, IPv4 address or IPv6 address.Valid endpoints are listed below: |
| | |https://s3.amazonaws.com |
| | |https://play.minio.io:9000 |
| | |localhost |
| | |play.minio.io|
| `endPoint` | _string_ | endPoint is a host name or an IP address. |
| `port` | _number_ | TCP/IP port number. This input is optional. Default value set to 80 for HTTP and 443 for HTTPs. |
| `accessKey` | _string_ |accessKey is like user-id that uniquely identifies your account. |
|`secretKey` | _string_ | secretKey is the password to your account.|
|`secure` | _bool_ |If set to true, https is used instead of http. Default is https if not set. |
|`secure` | _bool_ |If set to true, https is used instead of http. Default is true. |
|`region` | _string_ |Set this value to override auto bucket region discovery. (Optional)|

@@ -81,6 +73,5 @@

## Minio
## Create client for Minio
```js
var Minio = require('minio')

@@ -95,11 +86,8 @@

});
```
## AWS S3
## Create client for AWS S3
```js
var Minio = require('minio')

@@ -112,4 +100,2 @@

})
```

@@ -121,3 +107,3 @@

### makeBucket(bucketName, region, callback)
### makeBucket(bucketName, region[, callback])

@@ -142,3 +128,3 @@ Creates a new bucket.

| | |cn-north-1|
|`callback(err)` |_function_ | Callback function with `err` as the error argument. `err` is null if the bucket is successfully created. |
|`callback(err)` |_function_ | Callback function with `err` as the error argument. `err` is null if the bucket is successfully created. If no callback is passed, a `Promise` is returned. |

@@ -150,3 +136,2 @@

```js
minioClient.makeBucket('mybucket', 'us-east-1', function(err) {

@@ -156,7 +141,6 @@ if (err) return console.log('Error creating bucket.', err)

})
```
<a name="listBuckets"></a>
### listBuckets(callback)
### listBuckets([callback])

@@ -171,3 +155,3 @@ Lists all buckets.

|---|---|---|
|`callback(err, bucketStream) ` | _function_ | Callback function with error as the first argument. bucketStream is the stream emitting bucket information. |
|`callback(err, bucketStream) ` | _function_ | Callback function with error as the first argument. `bucketStream` is the stream emitting bucket information. If no callback is passed, a `Promise` is returned. |

@@ -187,3 +171,2 @@ bucketStream emits Object with the format:-

```js
minioClient.listBuckets(function(err, buckets) {

@@ -193,7 +176,6 @@ if (err) return console.log(err)

})
```
<a name="bucketExists"></a>
#### bucketExists(bucketName, callback)
#### bucketExists(bucketName[, callback])

@@ -209,3 +191,3 @@ Checks if a bucket exists.

| `bucketName` | _string_ | Name of the bucket. |
| `callback(err)` | _function_ | `err` is `null` if the bucket exists. `err.code` is `NoSuchBucket` in case the bucket does not exist. |
| `callback(err)` | _function_ | `err` is `null` if the bucket exists. `err.code` is `NoSuchBucket` in case the bucket does not exist. If no callback is passed, a `Promise` is returned. |

@@ -216,4 +198,2 @@ __Example__

```js
minioClient.bucketExists('mybucket', function(err) {

@@ -227,7 +207,6 @@ if (err) {

})
```
<a name="removeBucket"></a>
### removeBucket(bucketName, callback)
### removeBucket(bucketName[, callback])

@@ -242,3 +221,3 @@ Removes a bucket.

| `bucketName` | _string_ | Name of the bucket. |
| `callback(err)` | _function_ | `err` is `null` if the bucket is removed successfully. |
| `callback(err)` | _function_ | `err` is `null` if the bucket is removed successfully. If no callback is passed, a `Promise` is returned. |

@@ -249,3 +228,2 @@ __Example__

```js
minioClient.removeBucket('mybucket', function(err) {

@@ -255,4 +233,2 @@ if (err) return console.log('unable to remove bucket.')

})
```

@@ -295,7 +271,5 @@

```js
var stream = minioClient.listObjects('mybucket','', true)
stream.on('data', function(obj) { console.log(obj) } )
stream.on('error', function(err) { console.log(err) } )
```

@@ -338,7 +312,5 @@

```js
var stream = minioClient.listObjectsV2('mybucket','', true)
stream.on('data', function(obj) { console.log(obj) } )
stream.on('error', function(err) { console.log(err) } )
```

@@ -379,3 +351,2 @@

```js
var Stream = minioClient.listIncompleteUploads('mybucket', '', true)

@@ -391,3 +362,2 @@ Stream.on('data', function(obj) {

})
```

@@ -398,3 +368,3 @@

<a name="getObject"></a>
### getObject(bucketName, objectName, callback)
### getObject(bucketName, objectName[, callback])

@@ -410,3 +380,3 @@ Downloads an object as a stream.

| `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.|
| `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. |

@@ -417,3 +387,2 @@ __Example__

```js
var size = 0

@@ -434,6 +403,5 @@ minioClient.getObject('mybucket', 'photo.jpg', function(err, dataStream) {

})
```
<a name="getPartialObject"></a>
### getPartialObject(bucketName, objectName, offset, length, callback)
### getPartialObject(bucketName, objectName, offset, length[, callback])

@@ -451,3 +419,3 @@ Downloads the specified range bytes of an object as a stream.

| `length` | _number_ | `length` of the object that will be read in the stream (optional, if not specified we read the rest of the file from the offset). |
|`callback(err, stream)` | _function_ | Callback is called with `err` in case of error. `stream` is the object content stream.|
|`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. |

@@ -458,3 +426,2 @@ __Example__

```js
var size = 0

@@ -476,7 +443,6 @@ // reads 30 bytes from the offset 10.

})
```
<a name="fGetObject"></a>
### fGetObject(bucketName, objectName, filePath, callback)
### fGetObject(bucketName, objectName, filePath[, callback])

@@ -492,3 +458,3 @@ Downloads and saves the object as a file in the local filesystem.

| `filePath` | _string_ | Path on the local filesystem to which the object data will be written. |
| `callback(err)` | _function_ | Callback is called with `err` in case of error. |
| `callback(err)` | _function_ | Callback is called with `err` in case of error. If no callback is passed, a `Promise` is returned. |

@@ -500,3 +466,2 @@

```js
var size = 0

@@ -509,6 +474,5 @@ minioClient.fGetObject('mybucket', 'photo.jpg', '/tmp/photo.jpg', function(err) {

})
```
<a name="putObject"></a>
### putObject(bucketName, objectName, stream, size, contentType, callback)
### putObject(bucketName, objectName, stream, size, contentType[, callback])

@@ -530,3 +494,3 @@ Uploads an object from a stream/Buffer.

|`contentType` | _string_ | Content-Type of the object (optional, default `application/octet-stream`). |
| `callback(err, etag)` | _function_ | Non-null `err` indicates error, `etag` _string_ is the etag of the object uploaded.|
| `callback(err, etag)` | _function_ | Non-null `err` indicates error, `etag` _string_ is the etag of the object uploaded. If no callback is passed, a `Promise` is returned. |

@@ -539,3 +503,2 @@

```js
var Fs = require('fs')

@@ -552,3 +515,2 @@ var file = '/tmp/40mbfile'

})
```

@@ -574,3 +536,2 @@

```js
var buffer = 'Hello World'

@@ -580,6 +541,5 @@ minioClient.putObject('mybucket', 'hello-file', buffer, function(err, etag) {

})
```
<a name="fPutObject"></a>
### fPutObject(bucketName, objectName, filePath, contentType, callback)
### fPutObject(bucketName, objectName, filePath, contentType[, callback])

@@ -597,3 +557,3 @@ Uploads contents from a file to objectName.

| `contentType` | _string_ | Content-Type of the object. |
| `callback(err, etag)` | _function_ | Non-null `err` indicates error, `etag` _string_ is the etag of the object uploaded. |
| `callback(err, etag)` | _function_ | Non-null `err` indicates error, `etag` _string_ is the etag of the object uploaded. If no callback is passed, a `Promise` is returned. |

@@ -606,3 +566,2 @@ __Example__

```js
var file = '/tmp/40mbfile'

@@ -612,7 +571,6 @@ minioClient.fPutObject('mybucket', '40mbfile', file, 'application/octet-stream', function(err, etag) {

})
```
<a name="copyObject"></a>
### copyObject(bucketName, objectName, sourceObject, conditions, callback)
### copyObject(bucketName, objectName, sourceObject, conditions[, callback])

@@ -630,3 +588,3 @@ Copy a source object into a new object in the specied bucket.

| `conditions` | _CopyConditions_ | Conditions to be satisfied before allowing object copy. |
| `callback(err, {etag, lastModified})` | _function_ | Non-null `err` indicates error, `etag` _string_ and lastModified _Date_ are the etag and the last modified date of the object newly copied. |
| `callback(err, {etag, lastModified})` | _function_ | Non-null `err` indicates error, `etag` _string_ and lastModified _Date_ are the etag and the last modified date of the object newly copied. If no callback is passed, a `Promise` is returned. |

@@ -636,3 +594,2 @@ __Example__

```js
var conds = new Minio.CopyConditions()

@@ -647,3 +604,2 @@ conds.setMatchETag('bd891862ea3e22c93ed53a098218791d')

})
```

@@ -653,3 +609,3 @@

<a name="statObject"></a>
### statObject(bucketName, objectName, callback)
### statObject(bucketName, objectName[, callback])

@@ -665,3 +621,3 @@ Gets metadata of an object.

| `objectName` | _string_ | Name of the object. |
| `callback(err, stat)` | _function_ |`err` is not `null` in case of error, `stat` contains the object information listed below: |
| `callback(err, stat)` | _function_ |`err` is not `null` in case of error, `stat` contains the object information listed below. If no callback is passed, a `Promise` is returned. |

@@ -682,3 +638,2 @@

```js
minioClient.statObject('mybucket', 'photo.jpg', function(err, stat) {

@@ -690,7 +645,6 @@ if (err) {

})
```
<a name="removeObject"></a>
### removeObject(bucketName, objectName, callback)
### removeObject(bucketName, objectName[, callback])

@@ -706,3 +660,3 @@ Removes an object.

| objectName | _string_ | Name of the object. |
| `callback(err)` | _function_ | Callback function is called with non `null` value in case of error. |
| `callback(err)` | _function_ | Callback function is called with non `null` value in case of error. If no callback is passed, a `Promise` is returned. |

@@ -714,3 +668,2 @@

```js
minioClient.removeObject('mybucket', 'photo.jpg', function(err) {

@@ -722,7 +675,6 @@ if (err) {

})
```
<a name="removeIncompleteUpload"></a>
### removeIncompleteUpload(bucketName, objectName, callback)
### removeIncompleteUpload(bucketName, objectName[, callback])

@@ -738,3 +690,3 @@ Removes a partially uploaded object.

| `objectName` | _string_ | Name of the object. |
| `callback(err)` | _function_ |Callback function is called with non `null` value in case of error. |
| `callback(err)` | _function_ |Callback function is called with non `null` value in case of error. If no callback is passed, a `Promise` is returned. |

@@ -746,3 +698,2 @@

```js
minioClient.removeIncompleteUpload('mybucket', 'photo.jpg', function(err) {

@@ -754,3 +705,2 @@ if (err) {

})
```

@@ -763,3 +713,3 @@

<a name="presignedGetObject"></a>
### presignedGetObject(bucketName, objectName, expiry, cb)
### presignedGetObject(bucketName, objectName, expiry[, cb])

@@ -778,3 +728,3 @@ 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.

| `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. |
| `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. |

@@ -786,3 +736,2 @@

```js
// expires in a day.

@@ -793,7 +742,6 @@ minioClient.presignedGetObject('mybucket', 'hello.txt', 24*60*60, function(err, presignedUrl) {

})
```
<a name="presignedPutObject"></a>
### presignedPutObject(bucketName, objectName, expiry, callback)
### presignedPutObject(bucketName, objectName, expiry[, callback])

@@ -811,3 +759,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.

| `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. |
| `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. |

@@ -819,3 +767,2 @@

```js
// expires in a day.

@@ -826,7 +773,6 @@ minioClient.presignedPutObject('mybucket', 'hello.txt', 24*60*60, function(err, presignedUrl) {

})
```
<a name="presignedPostPolicy"></a>
### presignedPostPolicy(policy, callback)
### presignedPostPolicy(policy[, callback])

@@ -841,3 +787,3 @@ Allows setting policy conditions to a presigned URL for POST operations. Policies such as bucket name to receive object uploads, key name prefixes, expiry policy may be set.

| `policy` | _object_ | Policy object created by minioClient.newPostPolicy() |
| `callback(err, postURL, formData)` | _function_ | Callback function is called with non `null` err value in case of error. `postURL` will be the URL using which the object can be uploaded using POST request. `formData` is the object having key/value pairs for the Form data of POST body. |
| `callback(err, postURL, formData)` | _function_ | Callback function is called with non `null` err value in case of error. `postURL` will be the URL using which the object can be uploaded using POST request. `formData` is the object having key/value pairs for the Form data of POST body. If no callback is passed, a `Promise` is returned. |

@@ -849,5 +795,3 @@

```js
var policy = minioClient.newPostPolicy()
```

@@ -858,3 +802,2 @@

```js
// Policy restricted only for bucket 'mybucket'.

@@ -865,3 +808,2 @@ policy.setBucket('mybucket')

policy.setKey('hello.txt')
```

@@ -871,3 +813,2 @@ or

```js
// Policy restricted for incoming objects with keyPrefix.

@@ -886,3 +827,2 @@ policy.setKeyStartsWith('keyPrefix')

policy.setContentLengthRange(1024, 1024*1024)
```

@@ -894,3 +834,2 @@

```js
minioClient.presignedPostPolicy(policy, function(err, postURL, formData) {

@@ -914,3 +853,2 @@ if (err) return console.log(err)

})
```

@@ -923,3 +861,3 @@

<a name="getBucketNotification"></a>
### getBucketNotification(bucketName, cb)
### getBucketNotification(bucketName[, cb])

@@ -935,3 +873,3 @@ Fetch the notification configuration stored in the S3 provider and that belongs to the specified bucket name.

| `bucketName` | _string_ | Name of the bucket. |
| `callback(err, bucketNotificationConfig)` | _function_ | Callback function is called with non `null` err value in case of error. `bucketNotificationConfig` will be the object that carries all notification configurations associated to bucketName. |
| `callback(err, bucketNotificationConfig)` | _function_ | Callback function is called with non `null` err value in case of error. `bucketNotificationConfig` will be the object that carries all notification configurations associated to bucketName. If no callback is passed, a `Promise` is returned. |

@@ -943,3 +881,2 @@

```js
minioClient.getBucketNotification('mybucket', function(err, bucketNotificationConfig) {

@@ -949,7 +886,6 @@ if (err) return console.log(err)

})
```
<a name="setBucketNotification"></a>
### setBucketNotification(bucketName, bucketNotificationConfig, callback)
### setBucketNotification(bucketName, bucketNotificationConfig[, callback])

@@ -966,3 +902,3 @@ Upload a user-created notification configuration and associate it to the specified bucket name.

| `bucketNotificationConfig` | _BucketNotification_ | Javascript object that carries the notification configuration. |
| `callback(err)` | _function_ | Callback function is called with non `null` err value in case of error. |
| `callback(err)` | _function_ | Callback function is called with non `null` err value in case of error. If no callback is passed, a `Promise` is returned. |

@@ -973,3 +909,2 @@

```js
// Create a new notification object

@@ -993,7 +928,6 @@ var bucketNotification = new Notify.BucketNotification();

})
```
<a name="removeAllBucketNotification"></a>
### removeAllBucketNotification(bucketName, callback)
### removeAllBucketNotification(bucketName[, callback])

@@ -1008,3 +942,3 @@ Remove the bucket notification configuration associated to the specified bucket.

| `bucketName` | _string_ | Name of the bucket |
| `callback(err)` | _function_ | Callback function is called with non `null` err value in case of error. |
| `callback(err)` | _function_ | Callback function is called with non `null` err value in case of error. If no callback is passed, a `Promise` is returned. |

@@ -1054,3 +988,3 @@

<a name="getBucketPolicy"></a>
### getBucketPolicy(bucketName, objectPrefix, callback)
### getBucketPolicy(bucketName, objectPrefix[, callback])

@@ -1068,3 +1002,3 @@ Get the bucket policy associated with the specified bucket. If `objectPrefix`

| `objectPrefix` | _string_ | Prefix of objects in the bucket with which to filter permissions off of. Use `''` for entire bucket. |
| `callback(err, policy)` | _function_ | Callback function is called with non `null` err value in case of error. `policy` will be the string representation of the bucket policy (`minio.Policy.NONE`, `minio.Policy.READONLY`, `minio.Policy.WRITEONLY`, or `minio.Policy.READWRITE`). |
| `callback(err, policy)` | _function_ | Callback function is called with non `null` err value in case of error. `policy` will be the string representation of the bucket policy (`minio.Policy.NONE`, `minio.Policy.READONLY`, `minio.Policy.WRITEONLY`, or `minio.Policy.READWRITE`). If no callback is passed, a `Promise` is returned. |

@@ -1083,3 +1017,3 @@

<a name="setBucketPolicy"></a>
### setBucketPolicy(bucketName, objectPrefix, bucketPolicy, callback)
### setBucketPolicy(bucketName, objectPrefix, bucketPolicy[, callback])

@@ -1098,3 +1032,3 @@ Set the bucket policy associated with the specified bucket. If `objectPrefix`

| `bucketPolicy` | _string_ | The bucket policy. This can be: `minio.Policy.NONE`, `minio.Policy.READONLY`, `minio.Policy.WRITEONLY`, or `minio.Policy.READWRITE`. |
| `callback(err)` | _function_ | Callback function is called with non `null` err value in case of error. |
| `callback(err)` | _function_ | Callback function is called with non `null` err value in case of error. If no callback is passed, a `Promise` is returned. |

@@ -1101,0 +1035,0 @@

@@ -21,4 +21,2 @@ /*

var notify = require('gulp-notify');
var jscs = require('gulp-jscs');
var jshint = require('gulp-jshint');

@@ -28,2 +26,3 @@ var fs = require("fs");

var mocha = require('gulp-mocha')
var eslint = require('gulp-eslint')

@@ -50,3 +49,3 @@ gulp.task('browserify', ['compile'], function() {

gulp.task('test', ['compile', 'test:compile'], function() {
gulp.src('dist/test/unit/*.js', {
gulp.src('dist/test/**/*.js', {
read: false

@@ -60,34 +59,18 @@ })

gulp.task('jscs', function() {
gulp.src('src/main/*.js')
.pipe(jscs())
.pipe(notify({
title: 'JSCS',
message: 'JSCS Passed. Let it fly!'
}))
});
gulp.task('lint', function() {
gulp.src('src/main/*.js')
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'))
.pipe(notify({
title: 'JSHint',
message: 'JSHint Passed. Let it fly!',
}))
});
gulp.src('src/**/*.js')
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError())
})
gulp.task('functional-test', ['compile'], function() {
gulp.src('src/test/functional/functional-tests.js')
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist/test'))
.on('end', function() {
gulp.src('dist/test/functional-tests.js')
.pipe(mocha({
reporter: 'spec',
ui: 'bdd',
}))
compile('src/test/functional/*.js', 'functional', 'dist/test/functional/', function() {
gulp.src('dist/test/functional/*.js', {
read: false
})
.pipe(mocha({
reporter: 'spec',
ui: 'bdd',
}))
})

@@ -94,0 +77,0 @@ })

{
"name": "minio",
"version": "3.1.3",
"version": "3.2.0",
"description": "S3 Compatible Cloud Storage client",

@@ -10,3 +10,4 @@ "main": "./dist/main/minio.js",

"prepublish": "gulp test",
"functional": "gulp functional-test"
"functional": "gulp functional-test",
"browserify": "gulp browserify"
},

@@ -40,5 +41,5 @@ "repository": {

"mkdirp": "^0.5.1",
"moment": "^2.10.3",
"source-map-support": "^0.4.12",
"through2": "^0.6.5",
"uuid": "^3.1.0",
"xml": "^1.0.0",

@@ -50,10 +51,9 @@ "xml2js": "^0.4.15"

"chai": "^3.4.0",
"eslint": "^4.1.1",
"gulp": "^3.9.0",
"gulp-babel": "^5.2.1",
"gulp-jscs": "^2.0.0",
"gulp-jshint": "^1.11.2",
"gulp-eslint": "^4.0.0",
"gulp-mocha": "^2.1.0",
"gulp-notify": "^2.2.0",
"gulp-sourcemaps": "^1.5.2",
"jshint-stylish": "^2.0.1",
"mocha": "^2.3.2",

@@ -60,0 +60,0 @@ "nock": "^2.12.0",

@@ -15,3 +15,3 @@ # Minio JavaScript Library for Amazon S3 Compatible Cloud Storage [![Slack](https://slack.minio.io/slack?type=svg)](https://slack.minio.io)

```sh
npm install --save minio@3.1.3
npm install --save minio
```

@@ -54,16 +54,2 @@

If you are using minio-js version [2X](https://github.com/minio/minio-js/tree/release-2.0), Initialize Minio Client as below.
```js
var Minio = require('minio')
var minioClient = new Minio({
endPoint: 'play.minio.io',
port: 9000,
secure: true,
accessKey: 'Q3AM3UQ867SPQQA43P2F',
secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG'
});
```
## Quick Start Example - File Uploader

@@ -144,3 +130,3 @@

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

@@ -147,0 +133,0 @@

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

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

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc