File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -448,12 +448,9 @@ Float64Array.BYTES_PER_ELEMENT // 8
448448
449449### ArrayBuffer 与字符串的互相转换
450450
451- ` ArrayBuffer ` 和字符串相互转换, 使用原生 ` TextEncoder ` ` TextDecoder ` 类方法转换任何字符集字符串
452- outputEncoding 输出编码一般保持默认值(utf-8),可选值见文档:
453- - https://encoding.spec.whatwg.org
454- - https://nodejs.org/api/util.html#util_whatwg_supported_encodings
451+ ` ArrayBuffer ` 和字符串的相互转换,使用原生 ` TextEncoder ` 和 ` TextDecoder ` 方法。为了便于说明用法,下面的代码都按照 TypeScript 的用法,给出了类型签名。
455452
456- ``` ts
453+ ``` javascript
457454/**
458455 * Convert ArrayBuffer/TypedArray to String via TextDecoder
459456 *
@@ -485,6 +482,8 @@ function str2Uint8Array(input: string): Uint8Array {
485482}
486483```
487484
485+ 上面代码中,` ab2str() ` 的第二个参数` outputEncoding ` 给出了输出编码的编码,一般保持默认值(` utf-8 ` ),其他可选值参见[ 官方文档] ( https://encoding.spec.whatwg.org ) 或 [ Node.js 文档] ( https://nodejs.org/api/util.html#util_whatwg_supported_encodings ) 。
486+
488487### 溢出
489488
490489不同的视图类型,所能容纳的数值范围是确定的。超出这个范围,就会出现溢出。比如,8 位视图只能容纳一个 8 位的二进制值,如果放入一个 9 位的值,就会溢出。
You can’t perform that action at this time.
0 commit comments