Skip to content
This repository was archived by the owner on Apr 16, 2023. It is now read-only.

buhe/react-native-qiniu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e31f999 · Sep 10, 2021

History

28 Commits
Apr 14, 2016
Apr 12, 2016
Apr 22, 2016
Apr 12, 2016
Sep 10, 2021
Apr 14, 2016
Apr 22, 2016

Repository files navigation

React Native Qiniu SDK Build Status

纯JavaScript实现的Qiniu SDK,

安装

npm i react-native-qiniu  --save

使用方法

var qiniu = require('react-native-qiniu');
qiniu.conf.ACCESS_KEY = <AK>
qiniu.conf.SECRET_KEY = <SK>

//upload file to Qiniu
var putPolicy = new qiniu.auth.PutPolicy2(
    {scope: "<Bucket>:<Key>"}
);
var uptoken = putPolicy.token();
qiniu.rpc.uploadImage(<LOCAL_URL>, <KEY>, uptoken, function (resp) {
   console.log(JSON.stringify(resp));
});

//download private file
var getPolicy = new qiniu.auth.GetPolicy();
let url = getPolicy.makeRequest('http://7xp19y.com2.z0.glb.qiniucdn.com/5.jpg');
//fetch from this url

//image sync operation
var imgInfo = new qiniu.imgOps.ImageView(1,100,200);
let url = imgInfo.makeRequest('http://7xoaqn.com2.z0.glb.qiniucdn.com/16704/6806d20a359f43c88f1cb3c59980e5ef');
//fetch from this url

//image info 
var self = this;
var imgInfo = new qiniu.imgOps.ImageInfo();
let url = imgInfo.makeRequest('http://7xoaqn.com2.z0.glb.qiniucdn.com/16704/6806d20a359f43c88f1cb3c59980e5ef');
fetch(url).then((response) => {
      return response.text();
    }).then((responseText) => {
      self.setState({info: responseText});
    }).catch((error) => {
      console.warn(error);
    });

//resource operation   
//stat info
var self = this;
qiniu.rs.Client.stat(<BUCKET>, <KEY)
        .then((response) => response.text())
        .then((responseText) => {
          self.setState({info: responseText});
        })
        .catch((error) => {
          console.warn(error);
        });

进行中

  • 上传文件
  • 私有库中文件下载功能
  • Image Ops
  • 资源管理
  • 上传进度支持

相关文章

React Native 文件上传 和 react-native-qiniu

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published