Read directory content with file attributes: size, date, owner, mode.
With npm:
npm i readify --save
With bower:
npm i bower --save
Readify could be used in node.js based applications or in browsers with help of filer.
node.js
example:
const readify = require('readify');
// basic
readify('/', (error, data) => {
console.log(data);
// output
{
path: '/',
files: [{
name: 'readify.js',
size: '4.22kb',
date: '20.02.2016',
owner: 'coderaiser',
mode: 'rw- rw- r--',
}]
}
});
// raw output
readify('/', 'raw', (error, data) => {
console.log(data);
// output
{
path: '/',
files: [{
name: 'readify.js',
size: 4735,
date: 2016-11-21T13:37:55.275Z,
owner: 1000,
mode: 33204
}]
}
});
// sort output
// available sort option: name, size, owner, date
// available order option: asc, desc
readify('/', {sort: 'size', order: 'desc'}, (error, data) => {
console.log(data);
});
// all together
readify('/', {sort: 'size', order: 'desc', type: 'raw'}, (error, data) => {
console.log(data);
});
browser
example:
var fs = new Filer.FileSystem();
readify('/', function(error, data) {
console.log(error || data);
});
In old node.js
environments that supports es5
only, readify
could be used with:
var readify = require('readify/legacy');
MIT