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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-qiniu-uploader

v1.0.8

Published

Qiniu uploader

Readme

react-native-qiniu-uploader

Platform - Android and iOS MIT

| Author       |     E-mail    | | ------------- |:---------------:| | gufei         | [email protected]|

功能介绍

  • 支持 iOS Android  七牛云存储断点续传
  • 支持 上传图片和视频等其他文件

android 环境配置

  • 拷贝 android/RCTQiniu 文件夹下的所有文件至项目 app/src/main/java/com.yourcompany.qiniu/ 根目录

  • app/build.gradle 文件中新增:

compile 'com.qiniu:qiniu-android-sdk:7.3.+'
  • proguard-rules.pro 文件中新增混淆:
-keep class com.qiniu.**{*;}
-keep class com.qiniu.**{public <init>();}
-ignorewarnings
  • AndroidManifest.xml文件中添加授权:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

iOS 环境配置

  • 拷贝 ios/RCTQiniu 文件夹下的所有文件至项目 ios/ios_proj_name/ 根目录
  • cd rn_proj_name/ios/,执行 Pod init,生成 Podfile 和 Podfile.lock
  • 打开 Podfile,添加 pod "Qiniu", "~> 7.1.5"
  • 执行 Pod install
info.plist文件中添加授权:
<plist version="1.0">
  <dict>
    ...
    <key>NSPhotoLibraryUsageDescription</key>
    <string>$(PRODUCT_NAME) would like access to your photo gallery</string>
    <key>NSCameraUsageDescription</key>
    <string>$(PRODUCT_NAME) would like to use your camera</string>
    <key>NSPhotoLibraryAddUsageDescription</key>
    <string>$(PRODUCT_NAME) would like to save photos to your photo gallery</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>$(PRODUCT_NAME) would like to your microphone (for videos)</string>
  </dict>
</plist>

react-native

  拷贝QNEngine.js文件至ReactNative项目中

  import {QNEngine} from '../libs/QNEngine'
  
  componentDidMount() {
    //所有的原生通知统一管理
    QNEngine.eventEmitter({
            onProgress: (data) => {
                console.log(data.percent);
            },
            onComplete: (data) => {
                console.log(data)
            },
            onError: (data) => {
                console.log(data);
                switch (data.code) {
                    case '-2':
                        Toast.info('任务已暂停', 2)
                        break;
                    default:
                        Toast.fail('错误:' + data.msg, 2)
                        break;
                }
            }        
    })    
 }

  componentWillUnmount() {
    RtcEngine.removeEmitter()
  }
  
  /**
  * @param filePath:文件路径
  * @param upKey:文件名(唯一,不能重复)
  * @param upToken:上传token,服务端获取或本地生成
  * @param zone:上传至指定区域:华东:1,华北:2,华南:3,北美:4
  */     
  const params = {
        filePath: '文件路径',
        upKey: '文件名字',
        upToken: '上传token',
        zone: 1
       }
  QNEngine.setParams(params)
  
  // 开始上传任务
  QNEngine.startTask()
  
  // 暂停上传任务
  QNEngine.pauseTask()
  
  // 恢复上传任务
  QNEngine.resumeTask()
  

错误码

  1000 :success
  1001 :fail

  七牛错误代码:
  -2 :任务暂停
  -4 :文件路径不正确
  ...

运行示例

Example

运行示例图

更新信息

2018-04-21

  • android 客户端端封装完成

2018-04-20

  • iOS 客户端端封装完成