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

aloestec-rn-oss

v1.1.0

Published

A cross-platform React Native SDK for AliyunOSS Services, providing most of the OSS APIs, like client initialization, uploading & downloading etc.

Downloads

4

Readme

阿里云OSS

安装

yarn add aloestec-rn-oss

自动引入

    react-native link aloestec-rn-oss 

手动引入

Android

  1. 打开文件 android/app/src/main/java/[...]/MainApplication.java
  • 引入 import com.aloestec.oss.RNAliyunOssPackage
  • getPackages() 方法中添加 new RNAliyunOssPackage()
  1. 打开文件 android/settings.gradle 并添加:
include ':aloestec-rn-oss'
project(':aloestec-rn-oss').projectDir = new File(rootProject.projectDir, 	'../node_modules/aloestec-rn-oss/android')
  1. 打开文件 android/app/build.gradle 并添加:
dependencies{
    ...
    compile project(':aloestec-rn-oss')
}

IOS

  1. 在Xcode中选择 Libraries ➜ Add Files to [your project's name]。 选择 node_modules ➜ aloestec-rn-oss and add RNAliyunOss.xcodeproj

  2. 在XCode中, 到 Build Phases ➜ Link Binary With Libraries 添加 libRNAliyunOSS.a

  3. 在Xcode中选择 Frameworks ➜ Add Files to [your project's name]. 选择 node_modules ➜ aloestec-rn-oss ➜ AliyunSDK 添加 AliyunOSSiOS.framework

  4. 如果报错:framework not find AliyunOSSiOS , 设置 Build Settings -> Search Paths -> Framework Search Paths ,添加AliyunSDK的路径

issue

    Undefined symbols for architecture arm64:
    "_res_9_getservers", referenced from:
    -[OSSIPv6Adapter getDNSServersIpStack] in AliyunOSSiOS(OSSIPv6Adapter.o)
    "_res_9_ninit", referenced from:
    -[OSSIPv6Adapter getDNSServersIpStack] in AliyunOSSiOS(OSSIPv6Adapter.o)
    "_res_9_ndestroy", referenced from:
    -[OSSIPv6Adapter getDNSServersIpStack] in AliyunOSSiOS(OSSIPv6Adapter.o)
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

原因是不兼容IPv6-Only网路

解决方法:

OSS移动端SDK为了解决无线网络下域名解析容易遭到劫持的问题,已经引入了HTTPDNS进行域名解析, 直接使用IP请求OSS服务端。在IPv6-Only的网络下,可能会遇到兼容性问题。 而APP官方近期发布了关于IPv6-only网络环境兼容的APP审核要求,为此,SDK从2.5.0版本开始已经做了兼容性处理。 在新版本中,除了-ObjC的设置,还需要引入两个系统库:

libresolv.tbd
SystemConfiguration.framework
CoreTelephony.framework

项目默认不支持data://的格式上传,需要改源码 安卓:

 @ReactMethod
    public void asyncUpload(String bucketName, String ossFile, String sourceFile, final Promise promise) {
        // 构造上传请求
        if (sourceFile != null) {
            sourceFile = sourceFile.replace("file://", "");
        }
        PutObjectRequest put = null;
        if(sourceFile.startsWith("data://")) put = new PutObjectRequest(bucketName, ossFile, sourceFile.substring(7).getBytes(UTF8));
        else put = new PutObjectRequest(bucketName, ossFile, sourceFile);
        ObjectMetadata metadata = new ObjectMetadata();
        metadata.setContentType("application/octet-stream");
        put.setMetadata(metadata);
        ...

IOS:

-(void)beginUploadingWithFilepath:(NSString *)filepath resultBlock:(void (^) (NSData *))callback {
    
    // read asset data from filepath
    if ([filepath hasPrefix:@"data://"]) {
        NSData* data = [[filepath substringFromIndex:7] dataUsingEncoding:NSUTF8StringEncoding];
        callback(data);
    } else if ([filepath hasPrefix:@"assets-library://"]) {
        PHAsset *asset = [PHAsset fetchAssetsWithALAssetURLs:@[filepath] options:nil].firstObject;
        [self convertToNSDataFromAsset:asset withHandler:callback];
        
    } else if ([filepath hasPrefix:@"localIdentifier://"]) {
        NSString *localIdentifier = [filepath stringByReplacingOccurrencesOfString:@"localIdentifier://" withString:@""];
        PHAsset *asset = [PHAsset fetchAssetsWithLocalIdentifiers:@[localIdentifier] options:nil].firstObject;
        [self convertToNSDataFromAsset:asset withHandler:callback];
        
    } else {
        NSData *data = [NSData dataWithContentsOfFile:filepath];
        callback(data);
        
    }
}

使用