MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / read

Method read

tools/xsbug/esptool.js:305–320  ·  view source on GitHub ↗
(offset, size)

Source from the content-addressed store, hash-verified

303 this.parseReply(await this.getReply(timeout), Bootloader.ERASE_REGION);
304 }
305 async read(offset, size) {
306 const result = new Uint8Array(size);
307 let position = 0;
308 const limit = 512; // for WebUSB, no limit is needed. But, Web Serial overflows if this is much bigger.
309
310 while (size) {
311 const use = (size > limit) ? limit : size;
312 const part = await this.readPart(offset, use);
313 result.set(part, position);
314 position += use;
315 offset += use;
316 size -= use;
317 }
318
319 return result;
320 }
321 async readPart(offset, size) {
322// ROM loader is limited to sector boundaries but RAM loader supports arbitrary offsets
323// if ((offset % 4096) || (size % 4096))

Callers 1

getInfoMethod · 0.95

Calls 2

readPartMethod · 0.95
setMethod · 0.65

Tested by

no test coverage detected