tencent cloud

Tencent Cloud Observability Platform

protobuf.load

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2025-03-11 20:04:59
protobuf.load is used to load pb files.
load(importPaths: string[], ...filenames: string[]): void

Parameters

Parameter
Type
Description
importPaths
string[]
Used to search for the 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 protobuf from 'pts/protobuf';

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

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


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백