How do I make the content of an ArrayBuffer
immutable in Javascript? The Object.freeze()
method does not seem to be working. Is there any method to achieve it? Would it be even possible?
You can convert the ArrayBuffer
to an immutable string as a data URI
defined using const
const reader = new FileReader;
reader.onload = () => { const ab = reader.result // `ab` cannot be changed }
reader.readAsDataURL(new ArrayBuffer(123));
See Is it possible to delete a variable declared using const? ?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.