Baseline Widely available *
DataView
ë·°ë íë«í¼ì ìì²´ ìëì¸(ë°ì´í¸ ì ë ¬ ë°©ë²)ì ì ê²½ì°ì§ ìì¼ë©´ì ArrayBuffer
ìì ë¤ìí ì«ì ìë£íì ë°ì´í°ë¥¼ ì½ê³ ì°ê¸° ìí ì ìì¤ ì¸í°íì´ì¤ë¥¼ ì ê³µí©ëë¤.
ë¤ì¤ ë°ì´í¸ ì«ì ìë£íì ì¥ì¹ì ìí¤í
ì²ì ë°ë¼ ë©ëª¨ë¦¬ì ë¤ë¥´ê² ííë©ëë¤. ìëì¸ ì©ì´ ì¬ì ì ì°¸ê³ íì¸ì. DataView
ì ê·¼ìë ì½ë를 ì¤ííë ì»´í¨í°ì ìëì¸ì ê´ê³ ìì´ ë°ì´í°ì ì ê·¼ë²ì ëª
ìì ì¼ë¡ íµì í ì ììµëë¤.
const littleEndian = (() => {
const buffer = new ArrayBuffer(2);
new DataView(buffer).setInt16(0, 256, true /* littleEndian */);
// Int16Array uses the platform's endianness.
return new Int16Array(buffer)[0] === 256;
})();
console.log(littleEndian); // true or false
64ë¹í¸ ì ì ìë£í
JavaScriptë 64ë¹í¸ ì ìí ê°ì ëí íì¤ ì§ìì ìì§ ì ê³µíì§ ìì¼ë¯ë¡ DataView
ë 64ë¹í¸ ì°ì°ì ì§ìíì§ ììµëë¤. íìí ê²½ì° ìµë ì íë Number.MAX_SAFE_INTEGER
ì ê°ì ê°ì ¸ì¬ ì ìë getUint64()
í¨ì를 ë§ë¤ ìë ìì¼ë©°, ì´ë ì ëê¹ì§ë ì¶©ë¶í ê²ì
ëë¤.
function getUint64(dataview, byteOffset, littleEndian) {
// split 64-bit number into two 32-bit (4-byte) parts
const left = dataview.getUint32(byteOffset, littleEndian);
const right = dataview.getUint32(byteOffset + 4, littleEndian);
// combine the two 32-bit values
const combined = littleEndian
? left + 2 ** 32 * right
: 2 ** 32 * left + right;
if (!Number.isSafeInteger(combined))
console.warn(combined, "exceeds MAX_SAFE_INTEGER. Precision may be lost");
return combined;
}
ìì í ë²ìì 64ë¹í¸ë¥¼ ì§ìí´ì¼ í ê²½ì° BigInt
를 ì¬ì©íì¸ì. ë¨, BigInt
ë ì¬ì©ì ê³ì¸µ ë¼ì´ë¸ë¬ë¦¬ 구íì²´ë³´ë¤ë í¨ì¬ ë¹ ë¥´ì§ë§, ê°ë³ í¬ê¸°ë¼ë ì±ì§ë¡ ì¸í´ JavaScript 32ë¹í¸ ì ìë³´ë¤ë íì ë릴 ìë°ì ììµëë¤.
const BigInt = window.BigInt,
bigThirtyTwo = BigInt(32),
bigZero = BigInt(0);
function getUint64BigInt(dataview, byteOffset, littleEndian) {
// split 64-bit number into two 32-bit (4-byte) parts
const left = BigInt(dataview.getUint32(byteOffset | 0, !!littleEndian) >>> 0);
const right = BigInt(
dataview.getUint32(((byteOffset | 0) + 4) | 0, !!littleEndian) >>> 0,
);
// combine the two 32-bit values and return
return littleEndian
? (right << bigThirtyTwo) | left
: (left << bigThirtyTwo) | right;
}
ìì±ì
DataView()
ìë¡ì´ DataView
ê°ì²´ë¥¼ ìì±í©ëë¤.
ì´ ìì±ì DataView.prototype
ì ì ìëì´ ìì¼ë©° 모ë DataView
ì¸ì¤í´ì¤ì ê³µì ë©ëë¤.
DataView.prototype.buffer
ì´ ë·°ê° ì°¸ì¡°íë ArrayBuffer
ì
ëë¤. ìì± ìê°ì ê°ì´ ì í´ì§ê¸°ì ì½ê¸° ì ì©ì
ëë¤.
DataView.prototype.byteLength
ì´ ë·°ì 길ì´(ë°ì´í¸ ë¨ì)ì ëë¤. ìì± ìê°ì ê°ì´ ì í´ì§ê¸°ì ì½ê¸° ì ì©ì ëë¤.
DataView.prototype.byteOffset
ì´ ë·°ì ArrayBuffer
ì ììì ë¶í°ì ì¤íì
(ë°ì´í¸ ë¨ì)ì
ëë¤. ìì± ìê°ì ê°ì´ ì í´ì§ê¸°ì ì½ê¸° ì ì©ì
ëë¤.
DataView.prototype.constructor
ì¸ì¤í´ì¤ ê°ì²´ë¥¼ ìì±í ìì±ì í¨ìì
ëë¤. DataView
ì¸ì¤í´ì¤ì ê²½ì° ì´ê¸° ê°ì DataView
ìì±ìì
ëë¤.
DataView.prototype[@@toStringTag]
@@toStringTag
ìì±ì ì´ê¸° ê°ì 문ìì´ "DataView"
ì
ëë¤. ì´ ìì±ì Object.prototype.toString()
ìì ì¬ì©ë©ëë¤.
DataView.prototype.getBigInt64()
ì´ DataView
ì í¹ì ë°ì´í¸ ì¤íì
ììë¶í° 8ë°ì´í¸ë¥¼ ì½ì´ìì 64ë¹í¸ ë¶í¸ ìë ì ìë¡ í´ìí©ëë¤.
DataView.prototype.getBigUint64()
ì´ DataView
ì í¹ì ë°ì´í¸ ì¤íì
ììë¶í° 8ë°ì´í¸ë¥¼ ì½ì´ìì 64ë¹í¸ ë¶í¸ ìë ì ìë¡ í´ìí©ëë¤.
DataView.prototype.getFloat32()
ì´ DataView
ì í¹ì ë°ì´í¸ ì¤íì
ììë¶í° 4ë°ì´í¸ë¥¼ ì½ì´ìì 32ë¹í¸ ì¤ìë¡ í´ìí©ëë¤.
DataView.prototype.getFloat64()
ì´ DataView
ì í¹ì ë°ì´í¸ ì¤íì
ììë¶í° 8ë°ì´í¸ë¥¼ ì½ì´ìì 64ë¹í¸ ì¤ìë¡ í´ìí©ëë¤.
DataView.prototype.getInt16()
ì´ DataView
ì í¹ì ë°ì´í¸ ì¤íì
ììë¶í° 2ë°ì´í¸ë¥¼ ì½ì´ìì 16ë¹í¸ ë¶í¸ ìë ì ìë¡ í´ìí©ëë¤.
DataView.prototype.getInt32()
ì´ DataView
ì í¹ì ë°ì´í¸ ì¤íì
ììë¶í° 4ë°ì´í¸ë¥¼ ì½ì´ìì 32ë¹í¸ ë¶í¸ ìë ì ìë¡ í´ìí©ëë¤.
DataView.prototype.getInt8()
ì´ DataView
ì í¹ì ë°ì´í¸ ì¤íì
ììë¶í° 1ë°ì´í¸ë¥¼ ì½ì´ìì 8ë¹í¸ ë¶í¸ ìë ì ìë¡ í´ìí©ëë¤.
DataView.prototype.getUint16()
ì´ DataView
ì í¹ì ë°ì´í¸ ì¤íì
ììë¶í° 2ë°ì´í¸ë¥¼ ì½ì´ìì 16ë¹í¸ ë¶í¸ ìë ì ìë¡ í´ìí©ëë¤.
DataView.prototype.getUint32()
ì´ DataView
ì í¹ì ë°ì´í¸ ì¤íì
ììë¶í° 4ë°ì´í¸ë¥¼ ì½ì´ìì 32ë¹í¸ ë¶í¸ ìë ì ìë¡ í´ìí©ëë¤.
DataView.prototype.getUint8()
ì´ DataView
ì í¹ì ë°ì´í¸ ì¤íì
ììë¶í° 1ë°ì´í¸ë¥¼ ì½ì´ìì 8ë¹í¸ ë¶í¸ ìë ì ìë¡ í´ìí©ëë¤.
DataView.prototype.setBigInt64()
BigInt를 ë°ì ì´ DataView
ì ì§ì ë ë°ì´í¸ ì¤íì
ìì ììíì¬ 8ë°ì´í¸ì ê³µê°ì 64ë¹í¸ ë¶í¸ ìë ì ìë¡ ì ì¥í©ëë¤.
DataView.prototype.setBigUint64()
BigInt를 ë°ì ì´ DataView
ì ì§ì ë ë°ì´í¸ ì¤íì
ìì ììíì¬ 8ë°ì´í¸ì ê³µê°ì 64ë¹í¸ ë¶í¸ ìë ì ìë¡ ì ì¥í©ëë¤.
DataView.prototype.setFloat32()
ì«ì를 ë°ì ì´ DataView
ì ì§ì ë ë°ì´í¸ ì¤íì
ìì ììíì¬ 4ë°ì´í¸ì ê³µê°ì 32ë¹í¸ ì¤ìë¡ ì ì¥í©ëë¤.
DataView.prototype.setFloat64()
ì«ì를 ë°ì ì´ DataView
ì ì§ì ë ë°ì´í¸ ì¤íì
ìì ììíì¬ 8ë°ì´í¸ì ê³µê°ì 64ë¹í¸ ì¤ìë¡ ì ì¥í©ëë¤.
DataView.prototype.setInt16()
ì«ì를 ë°ì ì´ DataView
ì ì§ì ë ë°ì´í¸ ì¤íì
ìì ììíì¬ 2ë°ì´í¸ì ê³µê°ì 16ë¹í¸ ë¶í¸ ìë ì ìë¡ ì ì¥í©ëë¤.
DataView.prototype.setInt32()
ì«ì를 ë°ì ì´ DataView
ì ì§ì ë ë°ì´í¸ ì¤íì
ìì ììíì¬ 4ë°ì´í¸ì ê³µê°ì 32ë¹í¸ ë¶í¸ ìë ì ìë¡ ì ì¥í©ëë¤.
DataView.prototype.setInt8()
ì«ì를 ë°ì ì´ DataView
ì ì§ì ë ë°ì´í¸ ì¤íì
ìì ììíì¬ 1ë°ì´í¸ì ê³µê°ì 8ë¹í¸ ë¶í¸ ìë ì ìë¡ ì ì¥í©ëë¤.
DataView.prototype.setUint16()
ì«ì를 ë°ì ì´ DataView
ì ì§ì ë ë°ì´í¸ ì¤íì
ìì ììíì¬ 2ë°ì´í¸ì ê³µê°ì 16ë¹í¸ ë¶í¸ ìë ì ìë¡ ì ì¥í©ëë¤.
DataView.prototype.setUint32()
ì«ì를 ë°ì ì´ DataView
ì ì§ì ë ë°ì´í¸ ì¤íì
ìì ììíì¬ 4ë°ì´í¸ì ê³µê°ì 32ë¹í¸ ë¶í¸ ìë ì ìë¡ ì ì¥í©ëë¤.
DataView.prototype.setUint8()
ì«ì를 ë°ì ì´ DataView
ì ì§ì ë ë°ì´í¸ ì¤íì
ìì ììíì¬ 1ë°ì´í¸ì ê³µê°ì 8ë¹í¸ ë¶í¸ ìë ì ìë¡ ì ì¥í©ëë¤.
const buffer = new ArrayBuffer(16);
const view = new DataView(buffer, 0);
view.setInt16(1, 42);
view.getInt16(1); // 42
ëª
ì¸ì ë¸ë¼ì°ì í¸íì± ê°ì´ 보기
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4