Skip to content

mecctro/minio-js

 
 

Repository files navigation

Minio Javascript Library for Amazon S3 Compatible Cloud Storage Gitter

NPM

Install from npm

$ npm install --save minio

Install from source

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

Example in node

#!/usr/bin/env node

var Minio = require('minio')

var s3client = new Minio({
  endPoint:  's3.amazonaws.com',
  accessKey: 'YOUR-ACCESSKEYID',
  secretKey: 'YOUR-SECRETACCESSKEY'
})

s3client.listBuckets(function(e, bucketStream) {
  if (e) {
    console.log(e)
    return
  }
  bucketStream.on('data', function(obj) {
    console.log(obj)
  })
  bucketStream.on('end', function() {
    console.log("End")
  })
  bucketStream.on('error', function(e) {
    console.log("Error", e)
  })
})

Example in browser

<!doctype html>
<html>
  <body>
    <script type="text/javascript" src="<your-cdn>/minio-browser.js"></script>
    <script>
     var s3Client = new Minio({
      endPoint:  's3.amazonaws.com',
      accessKey: 'YOUR-ACCESSKEYID',
      secretKey: 'YOUR-SECRETACCESSKEY'
     });

     s3Client.getObject('krisupload', '40mbfile', function(e, dataStream) {
       if (e) {
         return console.log(e)
       }
       dataStream.on('data', function(chunk) {
         console.log(chunk.toString())
       })
     })
    </script>
  </body>
</html>

Documentation

API

Examples

Bucket

makeBucket(bucket, acl, region, cb)

listBuckets() : Stream

bucketExists(bucket, cb)

removeBucket(bucket, cb)

getBucketACL(bucket, cb)

setBucketACL(bucket, acl, cb)

listObjects(bucket, prefix, recursive) : Stream

listIncompleteUploads(bucket, prefix, recursive) : Stream

Object

fGetObject(bucket, object, filePath)

getObject(bucket, object) Stream

getPartialObject(bucket, object, offset, length) Stream

fPutObject(bucket, object, filePath, contentType, cb)

putObject(bucket, object, Stream, contentType, cb)

statObject(bucket, object, cb)

removeObject(bucket, object, cb)

removeIncompleteUpload(bucket, object, cb)

Presigned

presignedGetObject(bucket, object, expires) : String

presignedPutObject(bucket, object, expires) : String

presignedPostPolicy(postPolicy) : Object

Contribute

Contributors Guide

Build Status Build status

About

Minio Javascript Library for Amazon S3 compatible cloud storage

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%