Giter Site home page Giter Site logo

jsftp-lsr's Introduction

jsftp-lsr Build Status

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

jsftp-lsr's People

Contributors

drondov avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

peterkottas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.