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

osapi

v1.2.1

Published

A common Object Storage API

Downloads

2,420

Readme

"osapi" or "ceph"

Common and CEPH Compatible Object Storage API

Other Languages / 简体中文 / 繁體中文
If links in this document not avaiable, please access README on GitHub directly.

Milestone version 1.0.0 is released. The package now can be used to access different object storage servers.

Table of Contents

Description

The name osapi is abbreviation of Object Storage Application Programming Interface. And, because this API is compatible with CEPH object storage, so it is also named ceph. You may install and require one of osapi and ceph at your will. For simplicity, we use osapi hereinafter.

osapi is based on OpenStack SWIFT API and Amazon S3 API. Before [email protected], the package offers a standalone sub module for each style. Since 1.0.0, the two sub modules are nearly compatible with each other. Both of them implements a common interface Connection.

Table Of Contents

Links

Get Started

const osapi = require('osapi');

let conn = osapi.createConnection({
    endPoint   : 'http://storage.example.com/',
    subuser    : 'userName:subUserName',
    key        : '380289ba59473a368c593c1f1de6efb0380289ba5',
    container  : 'containerName',
});

conn.createObject('hello/world', 'Hello world!', (err) => {
    // ...
});

conn.readObject('hello/world', (err, data) => {
    // ...
    data.contentType;
    data.buffer;
});

Get Started With OpenStack Swift Server

const swift = require('osapi/swift');

let conn = new swift.Connection({
    endPoint   : 'http://storage.example.com/',
    subuser    : 'userName:subUserName',
    key        : '380289ba59473a368c593c1f1de6efb0380289ba5',
                 // generally 40 characters 
    tempURLKey : '380289ba59473a368c593c1f1de6efb0', 
                 // generally 32 characters
    container  : 'containerName',
});

conn.createObject('hello/world', 'Hello world!', (err) => {
    // ...
});

conn.readObject('hello/world', (err, data) => {
    // ...
    data.contentType;
    data.buffer;
});

Get Started With AWS S3 Server

const s3 = require('osapi/s3');

let conn = new s3.Connection({
    endPoint        : 'http://storage.example.com/',
    accessKey       : '380289ba59473a368c59', 
                      // 20 characters 
    secretAccessKey : '380289ba59473a368c593c1f1de6efb0380289ba5', 
                      // 40 characters
    bucket          : 'bucketName',
});

let options = {
    name: 'hello/world',
    meta: { /* self defined meta info */ }
};
let content = 'Hello world!';
conn.createObject(options, content)
    .then(ret => {
        // ...
    })
    .catch(err => {
        // ...
    });

conn.readObject('hello/world', (err, data) => {
    // ...
    data.contentType;
    data.buffer;
    data.meta;
});

API

Please read documentation.

Terms

Amazon Simple Storage Service (S3) and OpenStack Swift are similiar but still two different things.

| S3 | SWIFT | meaning | | :---------------- | :------------- | :------------- | | bucket | container | An container belongs to one account and is used to store objects. | | access_key | - | Unique token used to identify an account. | | secret_secret_key | - | Secret token accompanying the access_key and used to verify the requests. | | - | key | Secret token used to generate access token for current subuser. | | - | temp_url_key | Secret token used to generate temporary downloading URLs for objects. | | - | user | Account. | | - | subuser | User under specified account. |

About

For convenience, this package is published in following names (alias):

References