Socket
Socket
Sign inDemoInstall

directory-json

Package Overview
Dependencies
3
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    directory-json

Converts a directory strcture into JSON


Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Install size
1.94 MB
Created
Weekly downloads
 

Readme

Source

Directory JSON

Converts a directory structure into JSON

Installation

npm install directory-json --save

Project Usage

var directoryJson = require('directory-json')

directoryJson('./path/to/my/dir', function (err, res) {
  if (err) return console.error(err)
  console.log(res);
});

Cli Usage

  Usage: directory-json [options] <dir>

  Converts a directory structure into JSON

  Options:

    -v, --version          output the version number
    -c, --cwd <dir>        Relative from this directory
    -r, --recurse          Recurse sub-directories
    -l, --hash-length <n>  Length of the hash to remove from key names
    -p, --prettify         Prettify the JSON output
    -h, --help             output usage information

Options

options.cwd

Type: String Default value: '.'

Paths are relative from this directory.

options.recurse

Type: Boolean Default value: true

Whether to recurse through sub-directories.

options.hashLength

Type: Number Default value: 0

Length of the hash to remove from key names.

options.prettify

Type: Boolean Default value: false

Whether to prettify the JSON output.

Output

{
  "file1": "file1.txt",
  "folder": {
    "file2": "folder/file2.txt",
    "file3": "folder/file3.txt"
  }
}

Keywords

FAQs

Last updated on 05 May 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc