How to use minio - 10 common examples

To help you get started, we’ve selected a few minio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github minio / minio-js / examples / remove-incomplete-upload.js View on Github external
*     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, my-bucketname and
  // my-objectname 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'
})
// Remove a partially uploaded object name my-objectname.
s3Client.removeIncompleteUpload('my-bucketname', 'my-objectname', function(e) {
  if (e) {
    return console.log(e)
  }
  console.log("Success")
})
github minio / minio-js / examples / get-partialobject.js View on Github external
*     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, my-bucketname and my-objectname
 // 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'
})

// Download the object my-objectname at an offset 1024, for a total of 4096 bytes.
var size = 0
s3Client.getPartialObject('my-bucketname', 'my-objectname', 1024, 4096, function(e, dataStream) {
  if (e) {
    return console.log(e)
  }
  dataStream.on('data', function(chunk) {
    size += chunk.length
  })
  dataStream.on('end', function() {
    console.log("End. Total size = " + size)
github minio / minio-js / examples / bucket-exists.js View on Github external
*     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'
})

s3Client.bucketExists('my-bucketname', function(err, exists) {
  if (err) {
    return console.log(err)
  }
  if (exists) {
      console.log("Bucket exists.")
  }
})
github minio / minio-js / examples / list-buckets.js View on Github external
*
 *     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 and YOUR-SECRETACCESSKEY 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'
})

s3Client.listBuckets(function(e, buckets) {
  if (e) return console.log(e)
  console.log('buckets :', buckets)
})
github minio / minio-js / examples / copy-object.js View on Github external
* limitations under the License.
 */

 // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-bucketname, my-objectname,
 // my-src-bucketname and my-src-objectname 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'
}) 

var conds = new Minio.CopyConditions()
conds.setMatchETag('bd891862ea3e22c93ed53a098218791d')

s3Client.copyObject('my-bucketname', 'my-objectname', '/my-src-bucketname/my-src-objectname', conds, function(e, data) {
  if (e) {
    return console.log(e)
  }
  console.log("Successfully copied the object:")
  console.log("etag = " + data.etag + ", lastModified = " + data.lastModified)
})
github minio / minio-js / examples / set-bucket-notification.js View on Github external
// 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: 'localhost',
  port: 9000,
  useSSL: false,
  accessKey: 'YOUR-ACCESSKEYID',
  secretKey: 'YOUR-SECRETACCESSKEY'
})

var config = new Minio.NotificationConfig()
var arn = Minio.buildARN('minio', 'sqs', '', 1, 'webhook')
var queue = new Minio.QueueConfig(arn)

queue.addFilterSuffix('.jpg')
queue.addFilterPrefix('myphotos/')
queue.addEvent(Minio.ObjectCreatedAll)

config.add(queue)

s3Client.setBucketNotification('my-bucketname', config, function(e) {
  if (e) {
    return console.log(e)
  }
  console.log("Success")
})
github minio / minio-js / examples / set-bucket-notification.js View on Github external
// dummy values, please replace them with original values.


var Minio = require('minio')

var s3Client = new Minio.Client({
  endPoint: 'localhost',
  port: 9000,
  useSSL: false,
  accessKey: 'YOUR-ACCESSKEYID',
  secretKey: 'YOUR-SECRETACCESSKEY'
})

var config = new Minio.NotificationConfig()
var arn = Minio.buildARN('minio', 'sqs', '', 1, 'webhook')
var queue = new Minio.QueueConfig(arn)

queue.addFilterSuffix('.jpg')
queue.addFilterPrefix('myphotos/')
queue.addEvent(Minio.ObjectCreatedAll)

config.add(queue)

s3Client.setBucketNotification('my-bucketname', config, function(e) {
  if (e) {
    return console.log(e)
  }
  console.log("Success")
})
github minio / minio-js / examples / set-bucket-notification.js View on Github external
// 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: 'localhost',
  port: 9000,
  useSSL: false,
  accessKey: 'YOUR-ACCESSKEYID',
  secretKey: 'YOUR-SECRETACCESSKEY'
})

var config = new Minio.NotificationConfig()
var arn = Minio.buildARN('minio', 'sqs', '', 1, 'webhook')
var queue = new Minio.QueueConfig(arn)

queue.addFilterSuffix('.jpg')
queue.addFilterPrefix('myphotos/')
queue.addEvent(Minio.ObjectCreatedAll)

config.add(queue)

s3Client.setBucketNotification('my-bucketname', config, function(e) {
  if (e) {
    return console.log(e)
  }
  console.log("Success")
})
github grycap / oscar / ui / src / components / services.js View on Github external
created(){
        this.username_auth = localStorage.getItem("user");
        this.password_auth = localStorage.getItem("password");
        var minio_endpoint = localStorage.getItem("endpoint");
        var minio_port = localStorage.getItem("port");
        // var minio_useSSL = localStorage.getItem("useSSL");
        var minio_accessKey = localStorage.getItem("accessKey");
        var minio_secretKey = localStorage.getItem("secretKey");



        var Minio = require('minio')
        this.minioClient = new Minio.Client({
            endPoint: minio_endpoint,    
            port: parseInt(minio_port),   
            useSSL: true,
            accessKey: minio_accessKey,
            secretKey: minio_secretKey
        });
        this.minioClient.setRequestOptions({rejectUnauthorized: false})

    },
    methods: {
github cbdyzj / cbdyzj.github.io / language / javascript / code / minio.js View on Github external
const { Client } = require('minio')

const client = new Client({
    endPoint: 'localhost',
    port: 9000,
    secure: false,
    accessKey: 'access_key',
    secretKey: 'secret_key',
})

async function main() {
    const bucketName = 'foo'
    // 判断存在并创建
    try {
        await client.bucketExists(bucketName)
    } catch (error) {
        if (error.code === 'NoSuchBucket') {
            await client.makeBucket(bucketName, 'cn-north-1')
        }

minio

S3 Compatible Cloud Storage client

Apache-2.0
Latest version published 28 days ago

Package Health Score

89 / 100
Full package analysis