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包,报错
3086浏览 • 1回复 待解决
使用ohpm发布tgz文件时报错
1965浏览 • 1回复 待解决
如何使用ohpm引入三四方库
4395浏览 • 3回复 待解决
使用position之后height不生效
3517浏览 • 1回复 待解决
使用安装命令报错install invalid hap size
8637浏览 • 1回复 待解决
ohpm not set up有了解吗?
3747浏览 • 2回复 待解决
ohpm publish 推送har包大小限制
1649浏览 • 1回复 待解决
ohpmhar包文件存储集群化
1205浏览 • 1回复 待解决
mac系统,ohpm下载内容缓存地址
2185浏览 • 1回复 待解决
参数不识别(ohpm run)
1520浏览 • 1回复 待解决
HarmonyOS ohpm 无clear命令
1155浏览 • 1回复 待解决
ohpm unpublish 对于带group不成功
1784浏览 • 1回复 待解决
ohpm私仓找不到中心仓库
1529浏览 • 1回复 待解决
搭建ohpm私仓服务疑问?
2086浏览 • 1回复 待解决