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

galaxy-fds-sdk

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

galaxy-fds-sdk

Galaxy FDS SDK Nodejs,用户安装SDK后,可以非常容易地调用FDS提供的接口。

  • 0.2.5
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

简介

Galaxy FDS SDK Nodejs,用户安装SDK后,可以非常容易地调用FDS提供的接口。

Galaxy FDS 是小米云团队推出的文件存储服务。

安装

npm install galaxy-fds-sdk

使用

使用前需要在小米开放平台注册得到应用的AccessKey和SecretKey。

创建Bucket

var GalaxyFDS = require('galaxy-fds-sdk');
var FDSClient = GalaxyFDS.FDSClient;
var FDSClientConfiguration = GalaxyFDS.FDSClientConfiguration;

var client = new FDSClient(accessKey, accessSecret, config);

co(function *() {
    yield client.createBucket('bucketName');
}).then().catch();
// or
client.createBucket('bucektName').then().catch();

上传Object

yield client.putObject("bucket_name", "object_name", "value")

下载Object

yield client.getObject("bucket_name", "object_name")

删除Object

yield client.deleteObject("bucket_name", "object_name")

删除Bucket

yield client.deleteBucket("bucket_name")

其他

更多API操作请参考示例代码和文档。

实现

HTTP请求

FDS服务端可以响应带签名认证的HTTP请求,我们使用了requestretry以及requests库发送和接收请求。

Promise及Stream

本库利用了when.js;接口均以Promise形式提供。 getObject返回结果obj,其obj.stream是原生Request对象,FDSClient同时提供了streamToPromise方法,可将obj.stream按照Promise的形式操纵:

var obj = yiled.getObject('bucket_name', 'object_name');
obj.stream.pipe(process.stdout);
yield FDSClient.streamToPromise(obj.stream);

API

通过阅读FDS的API文档,我们实现了上传下载Object等接口。HTTP请求参数、Header等信息参见FDS官方文档。

FAQs

Package last updated on 21 Apr 2017

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