Skip to content

Commit 32764c3

Browse files
save file
1 parent d1db369 commit 32764c3

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,28 @@
168168

169169
btn.load = function(){
170170

171-
172-
console.json(filenav.cur);
171+
if(!filenav.cur.name){
172+
log.red('no file selected');
173+
return;
174+
}
175+
176+
var abs = filenav.cur.path+filenav.cur.name;
177+
var uint8 = await webcontainer.fs.readFile(abs);
178+
var blob = new Blob([uint8]);
173179

180+
var file = newfile({abs,name});
181+
complete.load(file,blob);
174182

175183
}//load
176184

177185

178186
btn.save = async function(){
179187

188+
if(!filenav.cur.name){
189+
log.red('no file selected');
190+
return;
191+
}
192+
180193
var blob = await source();
181194
var buf = await blob.arrayBuffer();
182195
var uint8 = new Uint8Array(buf);

0 commit comments

Comments
 (0)