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

swift

v2.8.0

Published

Openstack swift APIs

Downloads

2,034

Readme

Openstack swift client API with ES7 async/await design.

Build Status NPM Version Coverage Status License Code style

Installation

$ npm install swift

API/services (auth3)

Auth3 API will login to your openstack and use a X-Auth-Token in all operations. Make sure to renew (setInterval) the auth token periodicaly.

credentials

"use strict";

module.exports = {
    authUrl : "https://auth.cloud.ovh.net/v3", // default
    username : "OpenstackUsername", // required
    password : "OpenstackPassword", // required
    tenantId : "OpenstackProjectId", // one of tenantId or tenantName is required
    tenantName : "OpenstackProjectName", // one of tenantId or tenantName is required
    region: "WAW", // default "GRA3"
};

object-store

"use strict";

const fs      = require('fs');
const Context = require('swift/context');
const storage = require('swift/storage');

const pipe    = require('nyks/stream/pipe');
const creds   = require('./credentials');



class foo {
  async run(){
    // init token

    let container = 'mediaprivate';

    var ctx = await Context.build(creds);

    var files = await storage.toggleMode(ctx, container, ".r:*,.rlistings");
    var headers = await storage.showContainer(ctx, container);


    var remote = await storage.putFile(ctx, 'boucs.jpg', container, 'bouc.jpg');
    var local = fs.createWriteStream('tmp.jpg');

    var remote = storage.download(ctx, container, 'bouc.jpg');

    await pipe(remote, local);

    var remote = await storage.deleteFile(ctx, container, 'bouc.jpg');

    var files = await storage.getFileList(ctx, container);
    console.log({files, remote});
  }
}


module.exports = foo;

API/services (meta-temp-url-key)

Using a container meta-temp key, you can upload, retrieve or delete specific files in your container. On a CAS designed container, this should be considered as a best practice against a full container access.

object-store

"use strict";

const fs      = require('fs');
const Context = require('swift/context');
const storage = require('swift/storage');

const pipe    = require('nyks/stream/pipe');
const creds   = {
 "containers" : {

    "mediaprivate" : {
        "endpoint"     : "https://someopenstackswifthost/v1/AUTH_PROJECTID/mediaprivate",
        "temp-url-key" : "somesecret",
    }
 }

};


class foo {
  async run(){

    let container = 'mediaprivate';


    // does not init token, as no username is provided
    var ctx = await Context.build(creds);

    //please note that container level API won't work
    //var files = await storage.toggleMode(ctx, container, ".r:*,.rlistings");
    //var headers = await storage.showContainer(ctx, container);


    var remote = await storage.putFile(ctx, 'boucs.jpg', container, 'bouc.jpg');
    var local = fs.createWriteStream('tmp.jpg');

      //download through tempURL
    var remote = storage.download(ctx, container, 'bouc.jpg');

    await pipe(remote, local);

    var remote = await storage.deleteFile(ctx, container, 'bouc.jpg');

    var files = await storage.getFileList(ctx, container);
    console.log({files, remote});
  }
}


module.exports = foo;

Credits