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

apass-opensdk-hugong

v1.0.10

Published

飞书Apass低代码平台-飞书开放平台-相关的接口整合和常用的方法整合

Readme

apass-opensdk-hugong

简介

apass-opensdk-hugong 是一个Nodejs的SDK,提供了一些常用的功能

  • 什么人可以使用这个SDK
  • 从事飞书低代码平台(APASS)开发人员.传统Nodejs开发人员.

安装

在飞书低代码平台(云函数)依赖管理-右侧-搜索: apass-opensdk-hugong

如何使用

const Hugong = require('apass-opensdk-hugong');
初始化(主函数内),函数外不需要入参logger
const hg = new Hugong(logger)

也可以单独初始化logger模块
hg.setLogger(logger)

常用

记录时间
hg.newTime()
打印运行时间
hg.printTime()

安全的取值
hg.toValue({....},'a.b.c','default value')

线程睡眠(毫秒)
await hg.sleep(2000)

数组操作
1)生成指定范围的数组
const rangeValue = hg.utils.range(5,50, 3)
out=[ 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 44, 47, 50 ]
2)数组分块
const chunkValue = hg.utils.chunkAll(rangeValue, 5)
out=[ [ 5, 8, 11, 14, 17 ], [ 20, 23, 26, 29, 32 ], [ 35, 38, 41, 44, 47 ], [ 50 ] ]
数组分块输出1
hg.utils.splitArray([....], 5) 输出  [ [50],[50] ]
out=[ [ 5, 8, 11, 14, 17 ], [ 20, 23, 26, 29, 32 ], [ 35, 38, 41, 44, 47 ], [ 50 ] ]
数组分块输出2,每次输出50条 处理完成后继续下次执行
await hg.utils.splitArray([...], 10, async (items)=>{ // do something  })
移除重复项
hg.utils.unique([1,2,3,1,2,3]) // [1,2,3]

Apass相关,文件上传/下载

1)从网络下载文件后上传到飞书租户空间,返回上传后的文件信息
await hg.utils.file.downloadFileToUpload(url)
2)如果有鉴权, 可以传递header参数
await hg.utils.file.downloadFileToUpload(url,{ Authorization: `...`})
3)保存数据到本地环境中,比如接口返回的数据需要保存到本地环境中方便查看
saveDataToEnv(data,path) 

1)从飞书租户空间下载文件到本地环境中
  file_info={ id, mime_type, ...}
  file_path=存储地址可选,不填写则默认当前时间戳
await hg.utils.file.downloadFileToTmp(fileInfo,file_path)
如果是token文件
file_info={ token, mime_type, ...}
await hg.utils.file.downloadFileByToeknToTmp(file_info,file_path)

2)解析csv文件,file_path必须是本地环境的文件路径 /tep/aaa.csv 可以使用上面的方法downloadFileToTmp下载文件到本地环境中
await hg.utils.file.csvRead(file_path,callback)
示例1 读取完成后返回数组
const list = await hg.utils.file.csvRead(file_path)
示例2 读取完成后回调, 超过5000条建议使用此方法防止内存溢出
await hg.utils.file.csvRead(file_path,async (row)=>{
    // do something
})

3)解析excel文件,file_path必须是本地环境的文件路径 /tep/aaa.xlsx 可以使用上面的方法downloadFileToTmp下载文件到本地环境中
const list = hg.utils.file.xlsxReaderAll(file_path)
list是excel所有的内容,建议小文件使用(10M以下),如果是大文件10M以上转换成csv使用上面的方法,亲自测试10万条csv读取正常

小工具/多语言

对象数据新增多语言对象

生成多语言对象(将开放平台返回的多语言对象转换为application.constants.type.Multilingual)
hg.toMultilingualByOpenPlatform([{ lang: 'en-US', value: 'Regular' },{ lang: 'zh-CN', value: '正式' }]) 
hg.toMultilingualByOpenPlatform(zh,en)

交流学习

从事飞书低代码平台(APASS)开发人员3年,欢迎交流学习 VX:IAMRuiyu