mirror of
https://github.com/m1k1o/neko.git
synced 2025-05-22 21:47:08 +02:00
added file downloads to frontend
This commit is contained in:
parent
7c6029aa99
commit
b9f31cc19c
8 changed files with 185 additions and 25 deletions
|
@ -15,14 +15,20 @@ func ListFiles(path string) (*[]types.FileListItem, error) {
|
|||
out := make([]types.FileListItem, len(items))
|
||||
for i, item := range items {
|
||||
var itemType string = ""
|
||||
var size int64 = 0
|
||||
if item.IsDir() {
|
||||
itemType = "dir"
|
||||
} else {
|
||||
itemType = "file"
|
||||
info, err := item.Info()
|
||||
if err == nil {
|
||||
size = info.Size()
|
||||
}
|
||||
}
|
||||
out[i] = types.FileListItem{
|
||||
Filename: item.Name(),
|
||||
Type: itemType,
|
||||
Size: size,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue