buckets

Namespace

buckets

Source:

Methods

(static) createBucket(bucketName) → {Object}

Description:
Source:
Example

Usage

await Qarnot.buckets.createBucket('my-bucket');
Parameters:
Name Type Description
bucketName String name of the bucket to create
Returns:
Type
Object

(static) deleteBucket(bucketName) → {Promise}

Description:
Source:
Example

Usage

await Qarnot.buckets.deleteBucket('my-bucket-to-delete');
Parameters:
Name Type Description
bucketName String name of the bucket to delete
Returns:
Type
Promise

(static) deleteFile() → {Promise}

Description:
Source:
Example
await Qarnot.buckets.deleteFile('my-bucket', 'file.txt');
Returns:
Type
Promise

(static) download(bucketName, fileName) → {Promise.<Buffer>}

Description:
Source:
Examples

Usage

const data = await Qarnot.buckets.download('my-bucket', 'file.txt', params);
console.log(data)
console.log(data.Body.toString())

Output

{
   AcceptRanges: 'bytes',
   LastModified: 2019-06-11T20:13:17.000Z,
   ContentLength: 11,
   ETag: '"5eb63bbbe01eeed093cb22bb8f5acdc3"',
   ContentType: 'application/octet-stream',
   Metadata: {},
   Body: <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
}
hello world
Parameters:
Name Type Description
bucketName String name of the bucket
fileName String name of the file to create
Returns:
Type
Promise.<Buffer>

(static) listBuckets() → {Object}

Description:
Source:
Examples

Usage

const buckets = await Qarnot.buckets.listBuckets();
console.log(buckets);

Output

{
   Buckets: [
     { Name: 'my-bucket', CreationDate: 2019-06-11T12:59:43.743Z }
   ],
   Owner: { DisplayName: 'john.doe', ID: 'xx$xx' }
}
Returns:
List of all buckets
Type
Object

(static) listFiles(bucketName, paramsopt) → {Promise.<Object>}

Description:
Source:
Examples

Usage

const files = await Qarnot.buckets.listFiles('my-bucket');
console.log(files);

Output

{
  Contents: [
    {
      Key: 'test.txt',
      LastModified: 2023-05-30T09:30:53.873Z,
      ETag: '"f7482490035aa20e0bed1375d44e97bf"',
      Size: 17,
      StorageClass: 'STANDARD'
    }
  ],
  IsTruncated: false,
  KeyCount: 1,
  MaxKeys: 1000,
  Name: 'test-suite-nodejs',
  Prefix: ''
}
Parameters:
Name Type Attributes Description
bucketName String name of the bucket
params Object <optional>
custom params object for the storage API (see code and aws s3 sdk documentation)
Returns:
Files in your bucket
Type
Promise.<Object>

(static) upload(bucketName, fileName, data) → {Promise.<Object>}

Description:
Source:
Examples

Usage

const file = await Qarnot.buckets.upload('my-bucket', 'file.txt', data, mimetype);
console.log(file);

Output

 {
  ETag: '"f7482490035aa20e0bed1375d44e97bf"',
  Bucket: 'test-suite-nodejs',
  Key: 'test.txt',
  Location: 'https://test-suite-nodejs.storage.qarnot.com/test.txt'
}
Parameters:
Name Type Description
bucketName String name of the bucket
fileName String name of the file to create
data Buffer | ReadableStream | String data to upload
Returns:
Object describing the created file
Type
Promise.<Object>