0.0.1 • Published 8 years ago
filepaths-group v0.0.1
filepaths-group
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-groupUsage
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
0.0.1
8 years ago