@guestbell/jsftp-lsr
v1.0.0
Published
Recursively get nested directories with jsftp, like ls -R
Downloads
2
Maintainers
Readme
jsftp-lsr
Recursively get nested files with jsftp, like ls -R
Each directory has a property 'children' with nested files.
Install
$ npm install --save jsftp-lsr
Usage
var JSFtp = require('jsftp');
// decorate `JSFtp` with a new method `lsr`
JSFtp = require('jsftp-lsr')(JSFtp);
var path = 'public_html/deploy/foo';
ftp.lsr(path, function (err, data) {
console.log('File structure', JSON.stringify(data, null, 2));
});
Return example
[
{
"name": "bar",
"type": 1,
"time": 1462024620000,
"size": "102",
"owner": "ivan",
"group": "staff",
"userPermissions": {
"read": true,
"write": true,
"exec": true
},
"groupPermissions": {
"read": true,
"write": false,
"exec": true
},
"otherPermissions": {
"read": true,
"write": false,
"exec": true
},
"children": [
{
"name": "test.txt",
"type": 0,
"time": 1462024620000,
"size": "4",
"owner": "ivan",
"group": "staff",
"userPermissions": {
"read": true,
"write": true,
"exec": false
},
"groupPermissions": {
"read": true,
"write": false,
"exec": false
},
"otherPermissions": {
"read": true,
"write": false,
"exec": false
}
}
]
},
{
"name": "baz",
"type": 1,
"time": 1462024620000,
"size": "68",
"owner": "ivan",
"group": "staff",
"userPermissions": {
"read": true,
"write": true,
"exec": true
},
"groupPermissions": {
"read": true,
"write": false,
"exec": true
},
"otherPermissions": {
"read": true,
"write": false,
"exec": true
},
"children": []
}
]
API
JSFtp.lsr(path, callback)
path
Required
Type: string
Path of the directory which you want to see.
License
MIT © Ivan Drondov