JSPM

file-hierarchy

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q27776F
  • License MIT

Turn an entire directory tree into a js-hierarchy node

Package Exports

  • file-hierarchy

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (file-hierarchy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

file-hierarchy - Turn an entire directory tree into a js-hierarchy node

Build Status Coverage Status npm

Introduction

File-Hierarchy provides a JS-Hierarchy Node implementation, that turns a directory tree into a JS-Hierarchy tree using the scan-method.

Every directory entry is processed and its statistics data is gathered and saved. You can traverse the tree using JS-Hierarchy's standard walk feature.

Unlike JS-Hierarchy, this module is not available for the browser (like, duh!).

Installation

Install the module using

npm install file-hierarchy --save

If you're using Typescript, you might want to add the following typings:

npm install @types/bluebird @types/loglevel @types/node --save-dev

Usage

Typescript:

import { FileNode, ScanOptions } from '../lib/FileNode'

new FileNode().scan(new ScanOptions('/my/path'))
  .then(
    fileNode => {
      console.log(fileNode.path)
    }
  )

Javascript:

const fileHierarchy = require('file-hierarchy')

new fileHierarchy.FileNode().scan(new fileHierarchy.ScanOptions('/my/path'))
  .then(
    fileNode => {
      console.log(fileNode.path)
    }
  )

See the API-docs for details.

Building

To test and build this package, simply use grunt:

grunt test