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

@adriantombu/openstack-swift

v2.0.8

Published

A simple wrapper to easily use the Openstack Swift storage provider

Downloads

81

Readme

Openstack Swift storage

npm version Buy me a tree !

This library is a simple wrapper over pkgcloud to be able to use the Swift storage provider from Openstack easily.

A distributed object storage system designed to scale from a single machine to thousands of servers. Swift is optimized for multi-tenancy and high concurrency. Swift is ideal for backups, web and mobile content, and any other unstructured data that can grow without bound.

How to install it

  • Install the package from npm with yarn add @adriantombu/openstack-swift
  • Instanciate the library in your script
const swift = require('./lib').default.client({
  username: 'swift-username', // required
  password: 'swift-password', // required
  authUrl: 'swift-auth-url, // required
  region: 'swift-region'
  version: 'v3',
  keystoneAuthVersion: 'v3',
  domainName: 'Default'
})
  • Start using the library
const container = await swift.getContainer('my-container')

Container Model

A Container for OpenStack has following properties:

{
  name: 'my-container',
  count: 1, // number of files in your container
  bytes: 12345, // size of the container in bytes
  metadata: { // key value pairs for the container
    // ...
  }
}

File Model

A File for OpenStack has the following properties:

{
  name: 'my-file',
  container:  'my-container', // may be an instance of container if provided
  size: 12345, // size of the file in bytes
  contentType: 'plain/text' // Mime type for the file
  lastModified: Fri Dec 14 2012 10:16:50 GMT-0800 (PST), // Last modified date of the file
  etag: '1234567890abcdef', // MD5 sum of the file
  metadata: {} // optional object metadata
}

Available methods

swift.createContainer(container, metadata)

Creates a new container with the name from argument container. You can optionally provide metadata on the request:

swift.createContainer('my-container', {
  brand: 'bmw',
  model: '335i'
  year: 2009
})

swift.getContainer(container)

Retrieves the specified container from the current client instance.

swift.destroyContainer(container)

Removes the container from the storage account. If there are any files within the container, they will be deleted before removing the container on the client. result will be true on success.

swift.getContainerFiles(container)

Retreives an array of file for the provided container.

swift.removeContainerFiles(container)

Removes all the file from the provided container.

swift.getFile(container, filename)

Retrieves the specified file details in the specified container from the current client instance.

swift.downloadFile(container, filename)

Returns a readable stream. Download a file from a container.

swift.uploadFile(container, filename, data)

Returns a writableStream. Upload a new file to a container.

swift.removeFile(container, filename)

Removes the provided file from the provided container.

swift.getAllData(container)

Returns an array containing the container informations and a list of file.

{
  container: { ... },
  containerFiles: [ ... ],
}

How to contribute

  • Clone the repository git clone [email protected]:adriantombu/packages.git
  • Install the packages with yarn install
  • Modify the packages/openstack-swift/src/index.ts file
  • When everything's done, you can send a PR \o/