Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

coderaiser/readify

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

376 Commits
376 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Readify License NPM version Build Status Coverage Status

Read directory content with file attributes: size, date, owner, mode and type.

Install

With npm:

npm i readify

API

readify(dir [, options, ])

  • dir - path of a directory
  • options - object can contain:
    • type - type of result, could be "raw"
    • sort - sort by: name, size, date
    • order - "asc" or "desc" for ascending and descending order (default: "asc")

Examples

import {readify} from 'readify';

const {tryToCatch} = require('try-to-catch');

const [error, data] = await tryToCatch(readify, '/');
console.log(data);
// output
({
    path: '/',
    files: [{
        name: 'readify.js',
        size: '4.22kb',
        date: '20.02.2016',
        owner: 'coderaiser',
        mode: 'rw- rw- r--',
        type: 'file',
    }],
});

readify('/', {
    type: 'raw',
}).then(console.log);

// output
({
    path: '/',
    files: [{
        name: 'readify.js',
        size: 4735,
        date: '2016-11-21T13:37:55.275Z',
        owner: 1000,
        mode: 33_204,
        type: 'file',
    }],
});

readify('/', {
    type: 'raw',
    sort: 'size',
    order: 'desc',
}).then(console.log);

// output
({
    path: '/',
    files: [{
        name: 'readify.js',
        size: 4735,
        date: '2016-11-21T13:37:55.275Z',
        owner: 1000,
        mode: 33_204,
        type: 'file',
    }],
});

License

MIT

About

Read directory content with file attributes: size, date, owner, mode

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.