| 16 | globalThis.fs = { |
| 17 | constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1, O_DIRECTORY: -1 }, // unused |
| 18 | writeSync(fd, buf) { |
| 19 | outputBuf += decoder.decode(buf); |
| 20 | const nl = outputBuf.lastIndexOf("\n"); |
| 21 | if (nl != -1) { |
| 22 | console.log(outputBuf.substring(0, nl)); |
| 23 | outputBuf = outputBuf.substring(nl + 1); |
| 24 | } |
| 25 | return buf.length; |
| 26 | }, |
| 27 | write(fd, buf, offset, length, position, callback) { |
| 28 | if (offset !== 0 || length !== buf.length || position !== null) { |
| 29 | callback(enosys()); |