file-tree-sync

0.0.0 • Public • Published

file-tree-sync

A function that iterates recursively through a directory structure and returns it as a normal array. Supports glob syntax to ignore files if needed.

Usage

Installation:

$ npm install file-tree-sync

Use in your code:

var treeify = require('file-tree-sync');

var myTree = treeify(process.cwd(), ['.*']);

It returns an array that looks like this:

[
  {
    "name": "<name of file>",
    "fullpath": "<full path of file>",
    "relativePath": "<path relative to the directory you specified>"
    "files": [....] // array of the same type of object
  },
  ...
]

TODO

  • Handle file permission errors
  • An async version could be useful for other use cases than I had in mind initially
  • Write more tests

License

MIT license

Readme

Keywords

none

Package Sidebar

Install

npm i file-tree-sync

Weekly Downloads

0

Version

0.0.0

License

MIT

Last publish

Collaborators

  • arnorhs