TypedArr (TA07)
1: const number = 12345;
2: const buffer = new ArrayBuffer(4);
3: const view = new DataView(buffer);
4: view.setUint32(0, number, true); // true for Little-endian
5:
6: const byteArray = new Uint8Array(buffer);
7: const hexArray = Array.from(byteArray).map(byte => byte.toString(16).padStart(2, '0'));
8: console.log(hexArray); // Output: ["39", "30", "00", "00"]
4. Convert an Integer to a Hex Byte Array (Little-endian) and (Big-endian)
TypedArr context:
ES6 context:
Binary context:
- (2019) How to change image Exif metadata #Binary
- (2018) З'ясування алгоритмів оновлення Documat-CD SEB. #Binary
- (2016) JS6 Typed Array #ES6 #Binary
- (2015) Сховище графіки на SQL FileStream та канал браузеру multipart/form-data. #Sql #WebServiceClient #Binary
- (2012) Робота з байтами у VB.NET - ChrW, BitConverter.ToInt32, Convert.ToInt32, Byte.Parse, ToString("X2") / AllowHexSpecifier, GetBytes/GetString, New Byte(N) {}, UInt32 = &H33 #Binary #NetCommon
- (2005) DumpExe - утилитка дампирования структуры NET-сборок с открытым исходным текстом. #Binary #WinDesktop
- (2003) DVD - формат и обзор техник работы с ним. #Binary
- (2002) PE - формат исполняемого файла. #Binary
- (2002) FRX-парсер - моя утилитка для выкусывания рисунков из шестерочного FRX-файла. #WinDesktop #Vb6 #Binary
Comments (
)

Link to this page:
http://www.vb-net.com/JavascriptES6/TA07.htm
|