tree-view

2.2.0 • Public • Published

tree-view

Tree viewing widget for the browser

npm install tree-view

Try out the demo by doing

npm install
npm start

Usage

var path = require('path')
var tree = require('tree-view')
 
var browser = tree() // or tree({style:false}) to disable styling
 
browser.on('directory', function(p, entry) {
  console.log('You clicked on a directory (%s)', p)
  browser.directory(p, [{
    path: path.join(p, '/foo'),
    type: 'directory'
  }, {
    path: path.join(p, '/bar'),
    type: 'directory'
  }, {
    path: path.join(p, '/baz'),
    type: 'file'
  }])
})
 
browser.on('file', function(p, entry) {
  console.log('You clicked on a file (%s)', p)
})
 
browser.directory('/', [{
  path: '/foo',
  type: 'directory'
}, {
  path: '/bar',
  type: 'directory'
}, {
  path: '/baz',
  type: 'file'
}])
 
browser.appendTo(document.body)

Readme

Keywords

none

Package Sidebar

Install

npm i tree-view

Weekly Downloads

86

Version

2.2.0

License

BSD

Last publish

Collaborators

  • mafintosh