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

oss-upload-direct

v0.1.7

Published

This is Aliyun OSS JavaScript upload direct.

Downloads

20

Readme

oss-upload-direct

阿里云JavaScript客户端签名直传

Install

npm install --save oss-upload-direct

标签引入

<script type="text/javascript" src="/oss-upload-direct/dist/build.js"></script>
<script type="text/javascript">
  console.log(window.OSSUpload)
</script>

UMD导入

import OSSUpload from 'oss-upload-direct'
console.log(OSSUpload)

Usage

/**
 * @param { String } accessid { required: true }
 * @param { String } accesskey { required: true }
 * @param { String } host { default: 'http://post-test.oss-cn-hangzhou.aliyuncs.com' } // OSS目标主机
 * @param { Date } expiration { default: currentDate.getFullYear() + 10} // 失效时间,超过这个时间,就无法上传了。默认10年
 * @param { Number } file_size_max { default: 1048576000 } // 上传文件的最大限制
 * @param { String } object_name_type { default: 'random_name' } // 上传文件名,保持本地文件名 or 随机文件名。local_name or random_name
 * @param { String } dirname { default: '/' } // 目标目录
 */ 
const instance = new Upload({
  accessid: '6MKOqxGiGU4AUk44',
  accesskey: 'ufu7nS8kS59awNihtjSonMETLI0KLy',
})

/**
 * @param { DOM element/id } browse_button { required: true }
 * @param { String } runtimes { default: 'html5,flash,silverlight,html4' }
 * @param { String } url { default: 'http://oss.aliyuncs.com' }
 * @param { Promise } bindUploadEvent { required: true }  // 绑定点击添加文件事件
 * @param { Function } filesAdded  // 文件添加完成时的回调
 * @param { Function } beforeUpload  // 文件文件上传前的回调
 * @param { Function } uploadProgress  // 文件文件上传进度回调
 * @param { Function } fileUploaded  // 文件文件上传完成回调
 * @param { Function } error  // 文件文件上传失败回调
 */ 
const that = this
instance.init_plupload({
  browse_button: this.$refs.filterUpload,
  // 绑定点击事件
  bindUploadEvent: new Promise((resolve) => {
    that.$refs.submitUpload.onclick = (event) => {
      resolve(event)
      return false
    }
  }),
  filesAdded(up, files) {
    console.log('filesAdded: ')
    console.log(up, files)
  },
  beforeUpload(up, files) {
    console.log('beforeUpload: ')
    console.log(up, files)
  },
  uploadProgress(up, file) {
    console.log('uploadProgress: ')
    console.log(up, file)
  },
  fileUploaded(up, file, info) {
    console.log('fileUploaded: ')
    console.log(up, file, info)
  },
  error(up, err) {
    console.log('error: ')
    console.log(up, err)
  }
})

init_plupload参数 参照 -> plupload


Build Setup

# install dependencies
npm install

# serve with hot reload at 0.0.0.0:9090
npm run dev

# build for production with minification
npm run build