minio
Version:
S3 Compatible Cloud Storage client
38 lines (31 loc) • 1.41 kB
JavaScript
/*
* Minio Javascript Library for Amazon S3 Compatible Cloud Storage, (C) 2016 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, and my-bucketname
// are dummy values, please replace them with original values.
var Minio = require('minio')
var s3Client = new Minio.Client({
endPoint: 's3.amazonaws.com',
accessKey: 'YOUR-ACCESSKEYID',
secretKey: 'YOUR-SECRETACCESSKEY'
})
// Sets the bucket policy to 'readonly'. This means that objects can only be
// retrieved rather than created, modified, or destroyed in this bucket.
// The second parameter is for filtering based on objects — you can leave this
// empty if you'd like the permissions to apply to the entire bucket.
s3Client.setBucketPolicy('my-bucketname', '', Minio.Policy.READONLY, (err) => {
if (err) throw err
console.log('Set bucket policy to \'readonly\'.')
})