MCPcopy
hub / github.com/pyodide/pyodide / read

Method read

src/js/streams.ts:584–596  ·  view source on GitHub ↗
(buffer: Uint8Array)

Source from the content-addressed store, hash-verified

582 }
583
584 read(buffer: Uint8Array): number {
585 try {
586 return fs.readSync(this.stream.fd, buffer);
587 } catch (e) {
588 // Platform differences: on Windows, reading EOF throws an exception,
589 // but on other OSes, reading EOF returns 0. Uniformize behavior by
590 // catching the EOF exception and returning 0.
591 if ((e as Error).toString().includes("EOF")) {
592 return 0;
593 }
594 throw e;
595 }
596 }
597
598 fsync() {
599 nodeFsync(this.stream.fd);

Callers 2

streams.tsFile · 0.45
startRecvPumpFunction · 0.45

Calls 2

includesMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected