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

volcengine-sdk

v0.0.2

Published

Volcengine SDK for JS

Readme

备注:JS SDK 非火山引擎官方开发,由 KrisLee 开发。

前置准备

服务开通

请确保您已开通了您需要访问的服务。您可前往火山引擎控制台,在左侧菜单中选择或在顶部搜索栏中搜索您需要使用的服务,进入服务控制台内完成开通流程。

获取安全凭证

Access Key(访问密钥)是访问火山引擎服务的安全凭证,包含Access Key ID(简称为AK)和Secret Access Key(简称为SK)两部分。您可登录火山引擎控制台,前往“访问控制”的“访问密钥”中创建及管理您的Access Key。更多信息可参考访问密钥帮助文档

获取与安装

使用 npm 安装:

npm i volcengine-sdk

使用 <script> 标签引入:

<script type="module" src="./dist/volcengine-sdk.min.js" charset="utf-8"></script>

使用

文本翻译API 为例。

示例代码

// import VolcEngineSDK from "volcengine-sdk";
const VolcEngineSDK = require("volcengine-sdk");
const axios = require("axios");

const { ApiInfo, ServiceInfo, Credentials, API, Request } = VolcEngineSDK;

// 设置安全凭证 AK、SK
const AK = 'AccessKey ID';
const SK = 'AccessKey Secret';

// 翻译目标语言、翻译文本列表
const toLang = 'zh';
const textList = ['Hello world', 'こんにちは世界'];

// api凭证
const credentials = new Credentials(AK, SK, 'translate', 'cn-north-1');

// 设置请求的 header、query、body
const header = new Request.Header({
    'Content-Type': 'application/json'
});
const query = new Request.Query({
    'Action': 'TranslateText',
    'Version': '2020-06-01'
});
const body = new Request.Body({
    'TargetLanguage': toLang,
    'TextList': textList
});

// 设置 service、api信息
const serviceInfo = new ServiceInfo(
    'open.volcengineapi.com',
    header,
    credentials
);
const apiInfo = new ApiInfo('POST', '/', query, body);

// 生成 API
const api = API(serviceInfo, apiInfo);
// console.log(api.url, api.params, api.config);

// 获取 API 数据,发送请求
axios.post(api.url, api.params, api.config)
.then((res) => {
    console.log(res.data);
})
.catch((err) => {
    console.log('err', err);
});

返回数据

{
  "TranslationList": [
    { "Translation": "你好,世界", "DetectedSourceLanguage": "en", "Extra": null },
    { "Translation": "你好世界", "DetectedSourceLanguage": "ja", "Extra": null }
  ],
  "ResponseMetaData": {
    "RequestId": "202210082319500102081020661C043C5F",
    "Action": "TranslateText",
    "Version": "2020-06-01",
    "Service": "translate",
    "Region": "cn-north-1"
  }
}