This repository has been archived by the owner on Jul 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shulink the data size of JSON for file list.
- Loading branch information
Showing
12 changed files
with
63 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
-- Version 0.1.1 | ||
|
||
local fafm = require("fafm") | ||
|
||
while(1) do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
-- Version 0.1.1 | ||
|
||
local current_path = arguments.current_path or "/" | ||
|
||
-- Get file list under current_path | ||
local result = {} | ||
local full_path = "" | ||
local file_attr = nil | ||
local file_mode = "" | ||
for file_name in lfs.dir(current_path) do | ||
local full_path = current_path .. "/" .. file_name | ||
local file_attr = lfs.attributes(full_path) | ||
table.insert(result, { | ||
name=file_name, | ||
mode=file_attr.mode, | ||
size=file_attr.size, | ||
modification=file_attr.modification | ||
}) | ||
-- Skip dot files | ||
if file_name:sub(0, 1) ~= "." then | ||
full_path = current_path .. "/" .. file_name | ||
file_attr = lfs.attributes(full_path) | ||
-- Filter file or directory only | ||
if (file_attr.mode == "file") or (file_attr.mode == "directory") then | ||
-- Set mode initials. file:"f", directory:"d" | ||
file_mode = string.sub(file_attr.mode, 0, 1) | ||
table.insert(result, { | ||
n=file_name, | ||
m=file_mode, | ||
u=file_attr.modification | ||
}) | ||
end | ||
end | ||
end | ||
|
||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
-- Version 0.1.1 | ||
|
||
local current_path = arguments.current_path or "/" | ||
local file_name = arguments.file_name | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters