Files
bun.sh/examples/mmap/1.js
rml1997 1405158dfb Updated typo in example (#573)
Changed deocder to decoder
2022-07-11 05:26:45 -07:00

12 lines
316 B
JavaScript

const map = Bun.mmap("./mmap.txt", { shared: true });
const utf8decoder = new TextDecoder("utf-8");
let old = new TextEncoder().encode("12345");
setInterval(() => {
old = old.sort((a, b) => (Math.random() > 0.5 ? -1 : 1));
console.log(`changing mmap to ~> ${utf8decoder.decode(old)}`);
map.set(old);
}, 4);