Socket
Book a DemoInstallSign in
Socket

@byteplus/vcloud-sdk-nodejs

Package Overview
Dependencies
Maintainers
12
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@byteplus/vcloud-sdk-nodejs

Vcloud Byteplus OpenAPI SDK of NodeJs

latest
npmnpm
Version
1.0.5
Version published
Maintainers
12
Created
Source

BytePlus OpenAPI NodeJs SDK

Requirements:

  • Node.js >= 12

Installation

npm install -S @byteplus/vcloud-sdk-nodejs

Basic Usage

1. Setting OpenAPI service's AK&SK

Available in three settings

1. Use API to set AK&SK

import { vodOpenapi } from "@byteplus/vcloud-sdk-nodejs";
// Use the default service instance.
const vodService = vodOpenapi.defaultService;

// set aksk
vodService.setAccessKeyId(AccessKeyId);
vodService.setSecretKey(SecretKey);
// If you use sts to request, you need to set up `SessionToken` after aksk is set
vodService.setSessionToken(SessionToken);

2. Use environment variables to set AK & SK

BYTEPLUS_ACCESSKEY="your ak" BYTEPLUS_SECRETKEY="your sk"

3. Use configuration file

Put it in ~/.byteplus/config in json format, the format is:

{"BYTEPLUS_ACCESSKEY":"your ak","BYTEPLUS_SECRETKEY":"your sk"}

Request OpenAPI

Take the ListUsers API of the iam service as an example

import { vodOpenapi } from "@byteplus/vcloud-sdk-nodejs";

async function main(AccessKeyId, SecretKey) {
  // Use the default service instance.
  const vodService = vodOpenapi.defaultService;

  // set aksk
  vodService.setAccessKeyId(AccessKeyId);
  vodService.setSecretKey(SecretKey);

  // Request OpenAPI
  const usersResponse = await vodService.ListUsers({
    Limit: 10,
    Offset: 0,
  });
}

OpenAPI signature method

By HTTP Header

import { Signer } from "@byteplus/vcloud-sdk-nodejs";

// http request data
const openApiRequestData: RequestObj = {
  region: "ap-singapore-1",
  method: "GET",
  // [optional] http request url query
  params: {},
  // http request headers
  headers: {},
  // [optional] http request body
  body: "",
};

const signer = new Signer(openApiRequestData, "vod");

// sign
signer.addAuthorization({ accessKeyId, secretKey, sessionToken });

// Print signed headers
console.log(openApiRequestData.headers);

By HTTP Query

const openApiRequestData: RequestObj = {
  method: "POST",
  region: "ap-singapore-1",
  params: {
    Action: "UpdateSubtitleStatus",
    Version: "2023-01-01",
    Vid: "your vid",
    Status: "your status",
    FileIds: "your fileIds",
    Formats: "your formats",
    Languages: "your languages",
  },
};

const credentials: Credentials = {
  accessKeyId: BYTEPLUS_ACCESSKEY,
  secretKey: BYTEPLUS_SECRETKEY,
  sessionToken: "",
};

const signer = new Signer(openApiRequestData, "vod");

const signedQueryString = signer.getSignUrl(credentials);

FAQs

Package last updated on 15 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts