Skip to content

Commit 25077ec

Browse files
save file
1 parent 9b40176 commit 25077ec

1 file changed

Lines changed: 7 additions & 20 deletions

File tree

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

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -150,28 +150,15 @@
150150
var files = [];
151151

152152

153-
console.log(await webcontainer.fs.readdir('/'));
153+
var list = await webcontainer.fs.readdir(path,{withFileTypes:true})
154154

155+
list.forEach(item=>{
155156

156-
return;
157-
158-
159-
var {names:list} = await db.list(prefix+path,true);
160-
list.forEach(abs=>{
161-
162-
var i = abs.indexOf('/',len);
163-
//console.log(abs,i);
164-
var fn;
165-
if(i==-1){
166-
fn = abs.slice(len);
167-
if(fn){
168-
files.push(fn);
169-
}
170-
}else{
171-
fn = abs.slice(len,i);
172-
if(dirs.indexOf(fn)==-1){
173-
dirs.push(fn);
174-
}
157+
if(item.isFile()){
158+
files.push(item.name);
159+
}
160+
if(item.isDirectory()){
161+
dirs.push(item.name);
175162
}
176163

177164
});

0 commit comments

Comments
 (0)