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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cloud-flow/sdk

v1.0.3

Published

Cloud Flow 云函数客户端SDK

Readme

Cloud Flow 云函数客户端SDK

环境需求

  • Node.JS >= 10.0

安装

yarn add @cloud-flow/sdk

或者

npm install -S @cloud-flow/sdk

基本用法

初始化客户端

const { CloudFlowService } = require('@cloud-flow/sdk');

const client = new CloudFlowService({
  apiKey: '<YOUR_API_KEY>',
  // 工程 api key, 在 Cloud Flow 工程面板可以查看

  host: 'https://mrsongshu.com/cloud-flow/'
  // Cloud-Flow 云服务提供商网址
});

执行云函数

假设工程中有一个名为 test 的云函数:

module.exports = function test(options) {
  return options.message.toUpperCase();
}

在客户端可以按照如下方式执行:

await client.invoke('test', {
  message: 'hello world'
});

/**
 * 输出
 * HELLO WORLD
 * /

云函数默认的 HTTP 请求方法为 GET,要自定义请求方法,也可以在请求时给出更详细的配置:

await client.invoke('test', {
  message: 'hello world'
}, {
  method: 'POST',
  headers: {
    // custom headers here
  }
});

进阶用法

快照简介

对于非GET请求云函数,每次都要手动给定 HTTP 选项显然很繁琐,可以通过为云函数创建快照来简化步骤:

client.createSnapshot('test', {
  httpOptions: {
    method: 'POST'
  }
});

调用时只需调用快照即可

await client.snapshots.test({
  message: 'hello world'
});

其他快照用例

下面是快照的一些其他用法

自定义快照逻辑

client.createSnapshot('test', async function() {
  const output = await client.invoke('test', {
    message: 'hello world'
  });
  return output.split('').reverse().join('');
});
/**
 * 输出
 * DLROW OLLEH
 * /

手动指定云函数名(自定义快照名称)

client.createSnapshot('myTest', {
  functionName: 'test'
});
await client.snapshots.myTest({
  message: 'hello world'
});
/**
 * 输出
 * HELLO WORLD
 * /

提供默认参数

client.createSnapshot('test', {
  defaultParams: {
    message: 'hello world'
  }
});

await client.snapshots.test();
/**
 * 输出
 * HELLO WORLD
 * /