DataView.prototype.setBigUint64()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2021.
DataView
인스턴스의 setBigUint64()
메서드는 BigInt를 받아
이 DataView
의 지정된 바이트 오프셋의 8 바이트의 공간에 64비트 부호 없는 정수로 저장합니다.
정렬 제약 조건은 없으며, 범위 내의 모든 오프셋에서 멀티바이트 값을 저장할 수 있습니다.
시도해보기
// Create an ArrayBuffer with a size in bytes
const buffer = new ArrayBuffer(16);
// Highest possible BigInt value that fits in an unsigned 64-bit integer
const max = 2n ** 64n - 1n;
const view = new DataView(buffer);
view.setBigUint64(1, max);
console.log(view.getBigUint64(1));
// Expected output: 18446744073709551615n
구문
js
setBigUint64(byteOffset, value)
setBigUint64(byteOffset, value, littleEndian)
매개변수
byteOffset
-
데이터를 저장할 데이터 뷰의 시작점으로부터의 바이트 단위의 오프셋.
value
-
BigInt
로 설정할 값. 어떻게 값이 바이트로 인코딩되는지는 값 인코딩 및 정규화를 보시기 바랍니다. littleEndian
Optional-
리틀 엔디언 혹은 빅 엔디언 형식으로 데이터를 저장할지 여부를 나타냅니다.
false
혹은undefined
이라면 빅 엔디언 값을 읽습니다.
반환 값
예외
RangeError
-
뷰의 끝을 넘어서 저장하려고 하는
byteOffset
이 설정되면 발생합니다.
예제
setBigUint64() 사용하기
js
const buffer = new ArrayBuffer(10);
const dataview = new DataView(buffer);
dataview.setBigUint64(0, 3n);
dataview.getBigUint64(1); // 768n
명세서
Specification |
---|
ECMAScript® 2025 Language Specification # sec-dataview.prototype.setbiguint64 |
브라우저 호환성
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
setBigUint64 |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.