tencent cloud

Tencent Cloud Observability Platform

Client.load

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2025-03-11 20:04:58
Client.load is used to load pb files.
load(importPaths: string[], ...filenames: string[]): void

Parameters

Parameter
Type
Description
importPaths
string[]
Used to search for dependency paths referenced in import statements of proto source files; if no import path is provided, the current directory is assumed to be the only import path.
...filenames
string[]
The list of pb file names, supports calling with a single file name.

Return

Type
Description
void
No content returned.

Samples

Load a file from the root directory of the protocol file.
import grpc from 'pts/grpc';

const client = new grpc.Client();

// Load the addsvc.proto file from the root directory of the protocol file.
client.load([], 'addsvc.proto');
Load multiple files from a directory of the protocol file:
import grpc from 'pts/grpc';

const client = new grpc.Client();

// Load the addsvc.proto and example.proto files from the dirName directory of the protocol file.
client.load(['dirName'], 'addsvc.proto', 'example.proto');


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan