Skip to content

Commit 58bf163

Browse files
committed
fix(web-host): implement Descriptor#appendViaStream which makes tee -a work #12
1 parent 95af7b0 commit 58bf163

File tree

1 file changed

+11
-1
lines changed
  • packages/web-host/overrides/@bytecodealliance/preview2-shim/lib/browser

1 file changed

+11
-1
lines changed

packages/web-host/overrides/@bytecodealliance/preview2-shim/lib/browser/filesystem.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,17 @@ class Descriptor {
120120
}
121121

122122
appendViaStream() {
123-
console.log(`[filesystem] APPEND STREAM`);
123+
const entry = this.#entry;
124+
return new OutputStream({
125+
write (buf) {
126+
const entrySource = getSource(entry);
127+
const newSource = new Uint8Array(buf.byteLength + entrySource.byteLength);
128+
newSource.set(entrySource, 0);
129+
newSource.set(buf, entrySource.byteLength);
130+
entry.source = newSource;
131+
return buf.byteLength;
132+
}
133+
});
124134
}
125135

126136
advise(descriptor, offset, length, advice) {

0 commit comments

Comments
 (0)