Skip to content

Commit 7dbb907

Browse files
authored
README: Improve formatting of example code
1 parent 07410ef commit 7dbb907

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,18 @@ const data = Uint8Array.fromBase64(inputBase64);
6262
const dataLen = data.length;
6363
const dataLenStr = String(dataLen);
6464
const digitCount = dataLenStr.length;
65+
6566
// Transfer to a new ArrayBuffer with room for the netstring framing.
6667
const tmpBuf = data.buffer.transfer(digitCount + 1 + dataLen + 1);
6768
const tmpArr = new Uint8Array(tmpBuf);
6869
assert(tmpArr.buffer === tmpBuf);
70+
6971
// Frame the data.
7072
tmpArr.copyWithin(digitCount + 1, 0);
7173
for (let i = 0; i < digitCount; i++) tmpArr[i] = dataLenStr.charCodeAt(i);
7274
tmpArr[digitCount] = 0x3A;
7375
tmpArr[tmpArr.length - 1] = 0x2C;
76+
7477
// Transfer to an immutable ArrayBuffer backing a frozen Uint8Array.
7578
const netstringArr = Object.freeze(new Uint8Array(tmpBuf.transferToImmutable()));
7679
assert(tmpBuf.detached);

0 commit comments

Comments
 (0)