npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wasabi-s3

v1.0.0

Published

This repo is an updated version of https://bitbucket.org/javidgon/solid-bucket/src/master/ for wasabi deployments only.

Downloads

22

Readme

This repo is an updated version of https://bitbucket.org/javidgon/solid-bucket/src/master/ for wasabi deployments only.

2.7 Wasabi Object Storage

const WasabiS3 = require('wasabi-s3');

let provider = new WasabiS3('wasabi', {
  accessKeyId: 'accessKeyId',
  secretAccessKey: 'secretAccessKey',
});

3. Universal API

3.1 Create a Bucket

3.1.1 Definition

provider.createBucket(bucketName); // returns a Promise

3.1.2 Full Example

const WasabiS3 = require('wasabi-s3');

let provider = new WasabiS3('wasabi', {
  accessKeyId: 'accessKeyId',
  secretAccessKey: 'secretAccessKey',
});

let bucketName = 'example';
provider
  .createBucket(bucketName)
  .then((resp) => {
    if (resp.status === 201) {
      console.log(resp.message);
      // Output: Bucket "example" was created successfully
    }
  })
  .catch((resp) => {
    if (resp.status === 400) {
      console.log(resp.message);
      // Output: Some error coming from the provider...
    }
  });

3.2 Delete a Bucket

3.2.1 Definition

provider.deleteBucket(bucketName); //  returns a Promise

3.2.2 Full Example

const WasabiS3 = require('wasabi-s3');

let provider = new WasabiS3('wasabi', {
  accessKeyId: 'accessKeyId',
  secretAccessKey: 'secretAccessKey',
});

let bucketName = 'example';
provider
  .deleteBucket(bucketName)
  .then((resp) => {
    if (resp.status === 200) {
      console.log(resp.message);
      // Output: Bucket "example" was deleted successfully
    }
  })
  .catch((resp) => {
    if (resp.status === 400) {
      console.log(resp.message);
      // Output: Some error coming from the provider...
    }
  });

3.3 Upload File

3.3.1 Definition

provider.uploadFile(bucketName, filePath); //  returns a Promise

3.3.2 Full Example

const WasabiS3 = require('wasabi-s3');

let provider = new WasabiS3('wasabi', {
  accessKeyId: 'accessKeyId',
  secretAccessKey: 'secretAccessKey',
});

let bucketName = 'example';
let filePath = '/tmp/file.bin';
provider
  .uploadFile(bucketName, filePath)
  .then((resp) => {
    if (resp.status === 200) {
      console.log(resp.message);
      // Output: Bucket "example" was deleted successfully
    }
  })
  .catch((resp) => {
    if (resp.status === 400) {
      console.log(resp.message);
      // Output: Some error coming from the provider...
    }
  });

3.4 Download File

3.4.1 Definition

provider.deleteBucket(bucketName, remoteFilename downloadedFilePath) //  returns a Promise

3.4.2 Full Example

const WasabiS3 = require('wasabi-s3');

let provider = new WasabiS3('wasabi', {
  accessKeyId: 'accessKeyId',
  secretAccessKey: 'secretAccessKey',
});

let bucketName = 'example';
let remoteFilename = 'file.bin';
let downloadedFilePath = '/tmp';
provider
  .downloadFile(bucketName, remoteFilename, downloadedFilePath)
  .then((resp) => {
    if (resp.status === 200) {
      console.log(resp.message);
      // Output: Bucket "example" was deleted successfully
    }
  })
  .catch((resp) => {
    if (resp.status === 400) {
      console.log(resp.message);
      // Output: Some error coming from the provider...
    }
  });

3.5 Create File from Text in Bucket

3.5.1 Definition

provider.createFileFromText(bucketName, remoteFilename, text); // returns a Promise

3.5.2 Full Example

const WasabiS3 = require('wasabi-s3');

let provider = new WasabiS3('wasabi', {
  accessKeyId: 'accessKeyId',
  secretAccessKey: 'secretAccessKey',
});

let bucketName = 'example';
let remoteFilename = 'my_remote_object.txt';
let text = 'This is a text that I would like to upload';
provider
  .createFileFromText(bucketName, remoteFilename, text)
  .then((resp) => {
    if (resp.status === 200) {
      console.log(resp.message);
      // Output: Object "example.txt" was saved successfully in bucket "example"
    }
  })
  .catch((resp) => {
    if (resp.status === 400) {
      console.log(resp.message);
      // Output: Some error coming from the provider...
    }
  });

3.6 Delete file from Bucket

3.6.1 Definition

provider.deleteFile(bucketName, remoteFilename); // returns a Promise

3.6.2 Full Example

const WasabiS3 = require('wasabi-s3');

let provider = new WasabiS3('wasabi', {
  accessKeyId: 'accessKeyId',
  secretAccessKey: 'secretAccessKey',
});

let bucketName = 'example';
let remoteFilename = 'my_remote_object.txt';

provider
  .deleteFile(bucketName, remoteFilename)
  .then((resp) => {
    if (resp.status === 200) {
      console.log(resp.message);
      // Output: Object "example.txt" was deleted successfully from bucket "example"
    }
  })
  .catch((resp) => {
    if (resp.status === 400) {
      console.log(resp.message);
      // Output: Some error coming from the provider...
    }
  });

3.7 Read File from Bucket

3.7.1 Definition

provider.readFile(bucketName, remoteFilename); // returns a Promise

3.7.2 Full Example

const WasabiS3 = require('wasabi-s3');

let provider = new WasabiS3('wasabi', {
  accessKeyId: 'accessKeyId',
  secretAccessKey: 'secretAccessKey',
});

let bucketName = 'example';
let remoteFilename = 'my_remote_object.txt';
provider
  .readFile(bucketName, remoteFilename)
  .then((resp) => {
    if (resp.status === 200) {
      console.log(resp.message);
      // Output: Object "example.txt" was fetched successfully from bucket "example"
    }
  })
  .catch((resp) => {
    if (resp.status === 400) {
      console.log(resp.message);
      // Output: Some error coming from the provider...
    }
  });

3.8 Get list of objects from Bucket

3.8.1 Definition

provider.getListOfFiles(bucketName); // returns a Promise

3.8.2 Full Example

const WasabiS3 = require('wasabi-s3');

let provider = new WasabiS3('wasabi', {
  accessKeyId: 'accessKeyId',
  secretAccessKey: 'secretAccessKey',
});

let bucketName = 'example';
provider
  .getListOfFiles(bucketName)
  .then((resp) => {
    if (resp.status === 200) {
      console.log(resp.message);
      // Output: The list of objects was fetched successfully from bucket "example"
    }
  })
  .catch((resp) => {
    if (resp.status === 400) {
      console.log(resp.message);
      // Output: Some error coming from the provider...
    }
  });