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

ksyun-sdk-node

v1.5.2

Published

欢迎使用金山云开发者工具套件(SDK)。为方便 NODEJS 开发者调试和接入金山云产品 API,这里向您介绍适用于 NODEJS 的金山云开发工具包,并提供首次使用开发工具包的简单示例。让您快速获取金山云 NODEJS SDK 并开始调用。

Readme

简介

欢迎使用金山云开发者工具套件(SDK)。为方便 NODEJS 开发者调试和接入金山云产品 API,这里向您介绍适用于 NODEJS 的金山云开发工具包,并提供首次使用开发工具包的简单示例。让您快速获取金山云 NODEJS SDK 并开始调用。

依赖环境

  1. NODEJS 10.0.0 版本及以上
  2. 从金山云控制台 开通相应产品
  3. 获取 secretId、secretKey。

获取安装

安装 NODEJS SDK 前,先获取安全凭证。在第一次使用云 API 之前,用户首先需要在金山云控制台上申请安全凭证,安全凭证包括 secretId 和 secretKey, secretId 是用于标识 API 调用者的身份,secretKey 是用于加密签名字符串和服务器端验证签名字符串的密钥。secretKey 必须严格保管,避免泄露。

通过 Npm 安装

通过 npm 获取安装是使用 NODEJS SDK 的推荐方法,npm 是 NODEJS 的包管理工具。关于 npm 详细可参考 npm 官网

  1. 执行以下安装命令:

    npm install ksyun-sdk-node --save

  2. 在您的代码中引用对应模块代码,可参考示例。

通过源码包安装

  1. 前往 Github 仓库下载源码压缩包。
  2. 解压源码包到您项目合适的位置。
  3. 在您的代码中引用对应模块代码,可参考示例。

示例

const kscSdk = require('ksyun-sdk-node')

const Client = kscSdk.Iam.v20151101
const clientConfig = {
    // 认证信息
    credential: {
        secretId: '',
        secretKey: '',
    },
    // 产品地域
    region: "cn-beijing-6",
    // 可选配置实例
    httpProfile: {
        method: 'POST', // 请求方法 GET 或者 POST
        timeout: 60, // 请求超时时间秒
        protocol: '', // 协议 http:// 或者 https://
        endpoint: '' // 接入点域名 如 iam.api.ksyun.com
    },
}
let client = new Client(clientConfig)

/**
 * client.request 参数
 * @param {string} apiAction 接口名
 * @param {object} data 参数
 */

let apiAction = 'GetUser'
let data = {
    "UserName": "test14"
}

client.request(apiAction, data)
    .then(res => res.json())
    .then(data => {
        console.log(JSON.stringify(data))
    })
    .catch(err => {
        console.log(err)
    })

更多示例

参见金山云控制台-API Explorer-对应服务-SDK示例