ohpm install 之后的使用

ohpm install protobuf 这个库之后,我看里面有base64的子模块,但是不知道如何导入使用,请教一下如何使用,其中的index.d.ts文件内容如下:

/** 
 * Calculates the byte length of a base64 encoded string. 
 * @param {string} string Base64 encoded string 
 * @returns {number} Byte length 
 */ 
export function length(string: string): number; 
 
/** 
 * Encodes a buffer to a base64 encoded string. 
 * @param {Uint8Array} buffer Source buffer 
 * @param {number} start Source start 
 * @param {number} end Source end 
 * @returns {string} Base64 encoded string 
 */ 
export function encode(buffer: Uint8Array, start: number, end: number): string; 
 
/** 
 * Decodes a base64 encoded string to a buffer. 
 * @param {string} string Source string 
 * @param {Uint8Array} buffer Destination buffer 
 * @param {number} offset Destination offset 
 * @returns {number} Number of bytes written 
 * @throws {Error} If encoding is invalid 
 */ 
export function decode(string: string, buffer: Uint8Array, offset: number): number; 
 
/** 
 * Tests if the specified string appears to be base64 encoded. 
 * @param {string} string String to test 
 * @returns {boolean} `true` if it appears to be base64 encoded, otherwise false 
 */ 
export function test(string: string): boolean;
HarmonyOS
2024-11-15 10:32:57
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
zbw_apple

此方法属于三方库 protobufjs中定义的方法,在三方库里使用的,如果在HarmonyOS中使用base64,可以参考: ​https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-util-V5#base64helper9​。

分享
微博
QQ
微信
回复
2024-11-15 16:05:06
相关问题
通过ohpm install 第三方npm包,报错
1670浏览 • 1回复 待解决
使用ohpm发布tgz文件时报错
1049浏览 • 1回复 待解决
使用安装命令报错install invalid hap size
7745浏览 • 1回复 待解决
如何使用ohpm引入三四方库
3047浏览 • 3回复 待解决
使用position之后height不生效
2550浏览 • 1回复 待解决
ohpm not set up有了解吗?
2818浏览 • 2回复 待解决
Unable to install Toolchains有懂吗?
7606浏览 • 1回复 待解决
mac系统,ohpm下载内容缓存地址
1342浏览 • 1回复 待解决
ohpmhar包文件存储集群化
525浏览 • 1回复 待解决
ohpm publish 推送har包大小限制
805浏览 • 1回复 待解决
HarmonyOS ohpm 无clear命令
231浏览 • 1回复 待解决
参数不识别(ohpm run)
798浏览 • 1回复 待解决