#How to detect path is folder/file
1 messages · Page 1 of 1 (latest)
idk the proper way, but I'm just checking if the file has children
ig that wouldnt work for empty folders
you could check to see if maybe folders have an empty children array, whereas for files its undefined? Im not sure though
You can use the fs api
Idk if it has the is folder function is on javascript though
Can what SurprisedPika wrote work ?
it's better to use fs
its what it meant to do
I'm using fs, but fs dont detect for path, SurprisedPika method using fs and detect from entry.children
Thanks, your method is the best for this time

incase its not clear i was also using fs
My solution:
function isFolder(entry){
if (entry.children == undefined){
return false;
}
else{
return true;
}
}
Whatever 🤷♂️
presumably they are using fs to get the entry
I'm using frontend as Svelte/JS
just invoke the function then
or you dont know how to use them?
I know how to use it, but I don't know how to link this function, the one my colleague wrote above worked and I don't need to do any additional code, if there is a method to link main.rs with Svelte you can write
you will need this sooner or later (probably)
Thanks, have a nice day 🙂