First commit
This commit is contained in:
55
application/demo/fileManager/fileManager.list.js
Normal file
55
application/demo/fileManager/fileManager.list.js
Normal file
@@ -0,0 +1,55 @@
|
||||
|
||||
|
||||
import fileIcon from "./fileManager.icon.js";
|
||||
|
||||
import panel from "/elements/panel/row.js";
|
||||
|
||||
#ifdef SERVER
|
||||
|
||||
import fs from "fs";
|
||||
|
||||
import path from "path";
|
||||
|
||||
#endif
|
||||
|
||||
export default class fileList extends panel{
|
||||
|
||||
margin = 20;
|
||||
|
||||
padding = 20;
|
||||
|
||||
display = "block";
|
||||
|
||||
async create() {
|
||||
|
||||
this.empty();
|
||||
|
||||
var files = await this.readFiles();
|
||||
|
||||
}
|
||||
|
||||
node async readFiles() {
|
||||
|
||||
var absolutePath = path.resolve( "./assets/uploads/" );
|
||||
|
||||
var files = fs.readdirSync( absolutePath );
|
||||
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
|
||||
var file = files[i];
|
||||
|
||||
|
||||
var currentFileIcon = new fileIcon();
|
||||
|
||||
currentFileIcon.value = file;
|
||||
|
||||
this.add( currentFileIcon );
|
||||
|
||||
|
||||
}
|
||||
|
||||
return files;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user