公共基础库子系统JS API变更

OpenHarmony 3.2 Beta3版本相较于OpenHarmony 3.2 Beta2版本,公共基础库子系统的API变更如下:

接口变更

模块名 类名 方法/属性/枚举/常量 变更类型
ohos.buffer Blob text(): Promise<string>; 新增
ohos.buffer Blob slice(start?: number, end?: number, type?: string): Blob; 新增
ohos.buffer Blob arrayBuffer(): Promise<ArrayBuffer>; 新增
ohos.buffer Blob type: string; 新增
ohos.buffer Blob size: number; 新增
ohos.buffer Blob constructor(sources: string[] | ArrayBuffer[] | TypedArray[] | DataView[] | Blob[] , options?: Object); 新增
ohos.buffer Buffer writeUIntLE(value: number, offset: number, byteLength: number): number; 新增
ohos.buffer Buffer writeUIntBE(value: number, offset: number, byteLength: number): number; 新增
ohos.buffer Buffer writeUInt32LE(value: number, offset?: number): number; 新增
ohos.buffer Buffer writeUInt32BE(value: number, offset?: number): number; 新增
ohos.buffer Buffer writeUInt16LE(value: number, offset?: number): number; 新增
ohos.buffer Buffer writeUInt16BE(value: number, offset?: number): number; 新增
ohos.buffer Buffer writeUInt8(value: number, offset?: number): number; 新增
ohos.buffer Buffer writeIntLE(value : number, offset: number, byteLength: number): number; 新增
ohos.buffer Buffer writeIntBE(value: number, offset: number, byteLength: number): number; 新增
ohos.buffer Buffer writeInt32LE(value: number, offset?: number): number; 新增
ohos.buffer Buffer writeInt32BE(value: number, offset?: number): number; 新增
ohos.buffer Buffer writeInt16LE(value: number, offset?: number): number; 新增
ohos.buffer Buffer writeInt16BE(value: number, offset?: number): number; 新增
ohos.buffer Buffer writeInt8(value: number, offset?: number): number; 新增
ohos.buffer Buffer writeFloatLE(value: number, offset?: number): number; 新增
ohos.buffer Buffer writeFloatBE(value: number, offset?: number): number; 新增
ohos.buffer Buffer writeDoubleLE(value: number, offset?: number): number; 新增
ohos.buffer Buffer writeDoubleBE(value: number, offset?: number): number; 新增
ohos.buffer Buffer writeBigUInt64LE(value: bigint, offset?: number): number; 新增
ohos.buffer Buffer writeBigUInt64BE(value: bigint, offset?: number): number; 新增
ohos.buffer Buffer writeBigInt64LE(value: bigint, offset?: number): number; 新增
ohos.buffer Buffer writeBigInt64BE(value: bigint, offset?: number): number; 新增
ohos.buffer Buffer write(str: string, offset?: number, length?: number, encoding?: string): number; 新增
ohos.buffer Buffer toString(encoding?: string, start?: number, end?: number): string; 新增
ohos.buffer Buffer toJSON(): Object; 新增
ohos.buffer Buffer swap64(): Buffer; 新增
ohos.buffer Buffer swap32(): Buffer; 新增
ohos.buffer Buffer swap16(): Buffer; 新增
ohos.buffer Buffer subarray(start?: number, end?: number): Buffer; 新增
ohos.buffer Buffer readUIntLE(offset: number, byteLength: number): number; 新增
ohos.buffer Buffer readUIntBE(offset: number, byteLength: number): number; 新增
ohos.buffer Buffer readUInt32LE(offset?: number): number; 新增
ohos.buffer Buffer readUInt32BE(offset?: number): number; 新增
ohos.buffer Buffer readUInt16LE(offset?: number): number; 新增
ohos.buffer Buffer readUInt16BE(offset?: number): number; 新增
ohos.buffer Buffer readUInt8(offset?: number): number; 新增
ohos.buffer Buffer readIntLE(offset: number, byteLength: number): number; 新增
ohos.buffer Buffer readIntBE(offset: number, byteLength: number): number; 新增
ohos.buffer Buffer readInt32LE(offset?: number): number; 新增
ohos.buffer Buffer readInt32BE(offset?: number): number; 新增
ohos.buffer Buffer readInt16LE(offset?: number): number; 新增
ohos.buffer Buffer readInt16BE(offset?: number): number; 新增
ohos.buffer Buffer readInt8(offset?: number): number; 新增
ohos.buffer Buffer readFloatLE(offset?: number): number; 新增
ohos.buffer Buffer readFloatBE(offset?: number): number; 新增
ohos.buffer Buffer readDoubleLE(offset?: number): number; 新增
ohos.buffer Buffer readDoubleBE(offset?: number): number; 新增
ohos.buffer Buffer readBigUInt64LE(offset?: number): bigint; 新增
ohos.buffer Buffer readBigUInt64BE(offset?: number): bigint; 新增
ohos.buffer Buffer readBigInt64LE(offset?: number): bigint; 新增
ohos.buffer Buffer readBigInt64BE(offset?: number): bigint; 新增
ohos.buffer Buffer lastIndexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; 新增
ohos.buffer Buffer entries(): IterableIterator<[number, number]>; 新增
ohos.buffer Buffer values(): IterableIterator<number>; 新增
ohos.buffer Buffer keys(): IterableIterator<number>; 新增
ohos.buffer Buffer indexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; 新增
ohos.buffer Buffer includes(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): boolean; 新增
ohos.buffer Buffer equals(otherBuffer: Uint8Array | Buffer): boolean; 新增
ohos.buffer Buffer copy(target: Buffer | Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; 新增
ohos.buffer Buffer compare(target: Buffer | Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): -1 | 0 | 1; 新增
ohos.buffer Buffer fill(value: string | Buffer | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): Buffer; 新增
ohos.buffer Buffer byteOffset: number; 新增
ohos.buffer Buffer buffer: ArrayBuffer; 新增
ohos.buffer Buffer length: number; 新增
ohos.buffer buffer function transcode(source: Buffer | Uint8Array, fromEnc: string, toEnc: string): Buffer; 新增
ohos.buffer buffer function compare(buf1: Buffer | Uint8Array, buf2: Buffer | Uint8Array): -1 | 0 | 1; 新增
ohos.buffer buffer function isEncoding(encoding: string):boolean; 新增
ohos.buffer buffer function isBuffer(obj: Object): boolean; 新增
ohos.buffer buffer function from(array: number[]): Buffer;
function from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer;
function from(buffer: Buffer | Uint8Array): Buffer;
function from(object: Object, offsetOrEncoding: number | string, length: number): Buffer;
function from(string: String, encoding?: BufferEncoding): Buffer;
新增
ohos.buffer buffer function concat(list: Buffer[] | Uint8Array[], totalLength?: number): Buffer; 新增
ohos.buffer buffer function byteLength(string: string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer, encoding?: BufferEncoding): number; 新增
ohos.buffer buffer function allocUninitialized(size: number): Buffer; 新增
ohos.buffer buffer function allocUninitializedFromPool(size: number): Buffer; 新增
ohos.buffer buffer function alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer; 新增
ohos.util TextDecoder decodeWithStream(input: Uint8Array, options?: { stream?: boolean }): string; 新增
ohos.util util function parseUUID(uuid: string): Uint8Array; 新增
ohos.util util function randomBinaryUUID(entropyCache?: boolean): Uint8Array; 新增
ohos.util util function randomUUID(entropyCache?: boolean): string; 新增
ohos.worker DedicatedWorkerGlobalScope postMessage(messageObject: Object, transfer: Transferable[]): void;
postMessage(messageObject: Object, options?: PostMessageOptions): void;
postMessage(messageObject: Object, transfer: ArrayBuffer[]): void;
废弃