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

tan-qos-node-client

v0.0.4

Published

Node client for qos

Downloads

4

Readme

Node client for qos

Standard - JavaScript Style Guide

npm i -S qos-node-client

Usage

先创建一个qos client:

import qos from 'qos-node-client';

// const qos = require('qos-node-client').default;

const appId = '66666666';
const secretId = 'hello world';
const secretKey = '你好,世界';
const bucket = 'demo';

const client = qos.createClient({appId, secretId, secretKey, bucket});

上传:

const localFile = '/path/to/lovely-cat.jpg';
const fileId = '/dir/to/file.jpg';
client.upload({localFile, fileId})
  .then(res => {
    console.log('上传成功', res);
  })
  .catch(err => {
    console.error('上传文件时报错', err);
  });

更多参数及用法请参见test

实现的功能

  • 目录接口
    1. [x] 创建目录
    2. [x] 列出目录
    3. [x] 查询目录属性
    4. [x] 删除目录
  • 文件接口
    1. [x] 简单文件上传
    2. [x] 初始化文件上传
    3. [x] 逐个上传分片
    4. [x] 结束上传分片
    5. [x] 查询文件属性
    6. [x] 查询上传分片
    7. [x] 更新文件属性
    8. [x] 删除文件
    9. [x] 移动文件

入参说明

| 名称 | 类型 | 是否必填 | 说明 | |-----------|--------|----------|-----------------------------------| | appId | number | Y | appId | | secretId | string | Y | secretId | | secretKey | string | Y | secretKey | | region | string | Y | 区域 | | bucket | string | Y | bukcet | | fileId | string | N | 文件或文件夹名 | | timestamp | number | N | 时间戳,默认为当前时间 | | delta | number | N | 多久过期,默认5分钟 | | expired | number | N | 过期时间,默认等于timestamp+delta | | random | number | N | 随机数 | | auth | string | Y | Authorization | | bizAttr | string | N | 自定义属性 | | context | string | N | 翻页列出目录下文件时使用 | | num | number | N | 每页记录数,默认20 |

todo

  • [ ] 引入jest作为测试
  • [ ] 创建一个cli工具,用于在控制台上传、下载、查询文件

faq

  1. 如何确定入参fileId的值? fileId是bucket之后的路径名且必须以/开头。
    • 假设文件在bucket b中的位置是/b/path/file.ext, 则fileId=/path/file.ext
    • 假设文件夹在bucket b中的位置是/b/path/dir, 则fileId=/path/dir

Copyright and license

Code copyright 2016 Youmoo. Code released under the MIT license.