Skip to content

chiefbiiko/filepaths-group

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

filepaths-group

build status AppVeyor Build Status


Collapse an array of file objects into a grouped array (entire dirs/single files). Best to use in conjunction with drag-drop.


Get it!

npm install --save filepaths-group

Usage

Note that every object in the file array needs to have a .path property. If you want to get accumulated dir/file sizes back the input objects also need to have a numeric .size property.

var group = require('filepaths-group')

var files = [ { path: 'C:/COPYING'}, { path: 'C:/fraud.pem' } ]

group(files, function (err, grouped) {
  if (err) return console.error(err)
  console.log(grouped)
})

Grouped file objects have a .type property which either indicates a single file or an entire directory.


API

group(files[, opts], callback)

Collapse the input file object array into a labelled array of entire directories and single files. Calls back with callback(err, data). Options default to:

{
  size: false // indicate total sizes of files and directories
}

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published