mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-25 17:04:16 +00:00
refactor(commander) getFilesStat -> onStat
This commit is contained in:
parent
c0911f5181
commit
4d09a99857
1 changed files with 7 additions and 8 deletions
|
|
@ -41,9 +41,8 @@
|
|||
*/
|
||||
function readDir(params, error, files) {
|
||||
var i, n, stats, filesData, fill, name, fileParams,
|
||||
|
||||
p = params,
|
||||
dirPath = getDirPath(p.path);
|
||||
p = params,
|
||||
dirPath = getDirPath(p.path);
|
||||
|
||||
if (error)
|
||||
Util.exec(p.callback, error.toString());
|
||||
|
|
@ -72,7 +71,7 @@
|
|||
stats : stats,
|
||||
};
|
||||
|
||||
fs.stat(name, getFilesStat.bind(null, fileParams));
|
||||
fs.stat(name, onStat.bind(null, fileParams));
|
||||
}
|
||||
else
|
||||
fillJSON(filesData);
|
||||
|
|
@ -81,9 +80,9 @@
|
|||
|
||||
/**
|
||||
* async getting file states
|
||||
* and putting it to lStats object
|
||||
* and putting it to stats object
|
||||
*/
|
||||
function getFilesStat(params, error, stat) {
|
||||
function onStat(params, error, stat) {
|
||||
var n, keys, p = params;
|
||||
|
||||
if (!error)
|
||||
|
|
@ -105,10 +104,10 @@
|
|||
/**
|
||||
* Function fill JSON by file stats
|
||||
*
|
||||
* @param pStats - object, contain file stats.
|
||||
* @param stats - object, contain file stats.
|
||||
* example {'1.txt': stat}
|
||||
*
|
||||
* @param pFiles - array of files of current directory
|
||||
* @param files - array of files of current directory
|
||||
*/
|
||||
function fillJSON(pParams) {
|
||||
var name, stat, mode, isDir, size, owner, modeStr,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue