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

tim-upload-plugin

v1.4.1

Published

Tencent Cloud Upload To COS SDK for IM

Downloads

4,671

Readme

简介

腾讯云即时通信 IM 上传插件,用来上传图片、语音、视频、文件等类型的消息,支持 Web 和微信、QQ、百度、头条、支付宝小程序平台。

优势

使用 tim-upload-plugin 有以下4个优势:

  • 应用数据更安全
  • 上传文件速度较 cos-js-sdk 和 cos-wx-sdk 快10%~50%
  • 同时支持 Web 和微信、QQ、百度、头条、支付宝小程序平台
  • 体积非常小,仅26KB,对小程序应用更友好

注意事项

使用 tim-upload-plugin 需要注意以下2点:

1、使用前请将 tim-js-sdktim-wx-sdk 升级到v2.9.2或更高版本 2、小程序端使用 tim-upload-plugin,请在小程序管理后台将以下域名添加到 uploadFile 合法域名:

  • https://cos.ap-shanghai.myqcloud.com
  • https://cos.ap-shanghai.tencentcos.cn
  • https://cos.ap-guangzhou.myqcloud.com

将以下域名添加到 downloadFile 合法域名:

  • https://cos.ap-shanghai.myqcloud.com
  • https://cos.ap-shanghai.tencentcos.cn
  • https://cos.ap-guangzhou.myqcloud.com

使用方式

npm 引入

// 下载依赖
npm i tim-upload-plugin --save
// tim-js-sdk 的版本请使用 v2.9.2 或更高版本才能集成 tim-upload-plugin
npm i tim-js-sdk@latest --save

// 在项目脚本里引入模块,并初始化
import TIM from 'tim-js-sdk';
import TIMUploadPlugin from 'tim-upload-plugin';

let options = {
  SDKAppID: 0 // 接入时需要将0替换为您的云通信应用的 SDKAppID,类型为 Number
};
// 创建 SDK 实例,`TIM.create()`方法对于同一个 `SDKAppID` 只会返回同一份实例
let tim = TIM.create(options); // SDK 实例通常用 tim 表示

// 设置 SDK 日志输出级别,详细分级请参见 setLogLevel 接口的说明
tim.setLogLevel(0); // 普通级别,日志量较多,接入时建议使用
// tim.setLogLevel(1); // release级别,SDK 输出关键信息,生产环境时建议使用

// 注册 COS SDK 插件
tim.registerPlugin({'tim-upload-plugin': TIMUploadPlugin});

script 标签引入

<!-- tim-js.js 和 tim-upload-plugin.js 可以从 https://github.com/TencentCloud/TIMSDK/tree/master/Web/IMSDK 获取 -->
<script src='./tim-js.js'></script>
<script src='./tim-upload-plugin.js'></script>
<script>
let options = {
  SDKAppID: 0 // 接入时需要将0替换为您的云通信应用的 SDKAppID,类型为 Number
};
// 创建 SDK 实例,`TIM.create()`方法对于同一个 `SDKAppID` 只会返回同一份实例
let tim = TIM.create(options);
// 设置 SDK 日志输出级别,详细分级请参见 setLogLevel 接口的说明
tim.setLogLevel(0); // 普通级别,日志量较多,接入时建议使用
// tim.setLogLevel(1); // release级别,SDK 输出关键信息,生产环境时建议使用

// 注册 COS SDK 插件
tim.registerPlugin({'tim-upload-plugin': TIMUploadPlugin});

// 接下来可以通过 tim 进行事件绑定和构建 IM 应用
</script>