Skip to content

Commit 3544b30

Browse files
save file
1 parent a16f861 commit 3544b30

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

utils/misc/nodejs-terminal/html/webcontainer-fs/webcontainer-fs.html

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -428,13 +428,27 @@
428428
//:
429429

430430

431-
432-
433-
434-
435-
436-
437-
431+
obj.write = async function(path,blob){
432+
433+
var buf = await blob.arrayBuffer();
434+
var uint8 = new Uint8Array(buf);
435+
await webcontainer.fs.writeFile(path,uint8);
436+
437+
}//write
438+
439+
440+
obj.read = async function(path){
441+
442+
var uint8 = await webcontainer.fs.readFile(path);
443+
var blob = new Blob([uint8]);
444+
return blob;
445+
446+
}//read
447+
448+
449+
450+
451+
//:
438452

439453

440454

0 commit comments

Comments
 (0)