Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ceph

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ceph

A common Object Storage API

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

"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 osapi@1.0.0, 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

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.

S3SWIFTmeaning
bucketcontainerAn 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.
-keySecret token used to generate access token for current subuser.
-temp_url_keySecret token used to generate temporary downloading URLs for objects.
-userAccount.
-subuserUser under specified account.

About

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

References

Keywords

FAQs

Package last updated on 07 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc