Beta
Converts a DataView to a string.
The DataView to convert.
The encoding to use.
The string representation of the DataView.
const str = 'hello world';const codes = strToCodes(str);const buffer = new ArrayBuffer(codes.length);const dataView = new DataView(buffer);// Fill DataView with string datafor (let i = 0; i < codes.length; i++) { dataView.setUint8(i, codes[i]);}equal(dataViewToString(dataView, UTF_8), str); Copy
const str = 'hello world';const codes = strToCodes(str);const buffer = new ArrayBuffer(codes.length);const dataView = new DataView(buffer);// Fill DataView with string datafor (let i = 0; i < codes.length; i++) { dataView.setUint8(i, codes[i]);}equal(dataViewToString(dataView, UTF_8), str);
Converts a DataView to a string.