Socket
Socket
Sign inDemoInstall

folder2some

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

folder2some

A simple util to convert folder into some structures(like JSON,Tree,Info).


Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

folder2some

folder2some is a simple util to convert folder into some structures(like JSON,Tree,Info).

Installation

npm install folder2some

Usage & Input

let ft = require('./ft.js'),
    dir = 'F://web//javascript';

folder to tree

console.log( ft.toTree(dir) )

node test.js
input like :

├─clone               
│   └─cloner.js       
├─es6                 
│   └─es6.js          
├─filestype           
│   ├─test.js         
│   └─ft.js           
├─gallery             
│   ├─utils.js        
│   ├─gallery.styl    
│   └─gallery.js      
├─zepto               
│   ├─test            
│   │   ├─test2       
│   │   │   └─2.html  
│   │   └─1.html      
│   ├─test2           
│   └─zepto.js        
├─text.html           
└─1.html  

folder to JSON

console.log( ft.toJson(dir) )

node test.js
input like :

[                        
  "1.html",              
  {                      
    "clone": [           
      "cloner.js"        
    ]                    
  },                     
  {                      
    "es6": [             
      "es6.js"           
    ]                    
  },                     
  {                      
    "filestype": [       
      "ft.js",           
      "test.js"          
    ]                    
  },                     
  {                      
    "gallery": [         
      "gallery.js",      
      "gallery.styl",    
      "utils.js"         
    ]                    
  },                     
  "text.html",           
  {                      
    "zepto": [           
      {                  
        "test": [        
          "1.html",      
          {              
            "test2": [   
              "2.html"   
            ]            
          }              
        ]                
      },                 
      {                  
        "test2": []      
      },                 
      "zepto.js"         
    ]                    
  }                      
]                       

folder analysis

console.log(ft.toAnalysis(dir))

node test.js
input like :

{
  "path": "F://web//javascript",
  "totalSize": "85.56KB",
  "totalCount": 12,
  "extPercent": [
    {
      "ext": ".html",
      "percent": "0.00",
      "count": 4
    },
    {
      "ext": ".js",
      "percent": "99.04",
      "count": 7
    },
    {
      "ext": ".styl",
      "percent": "0.96",
      "count": 1
    }
  ]
}          

About me

github: https://github.com/Lemonreds e-mail: lemonreds@163.com

Keywords

FAQs

Package last updated on 21 Mar 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc