npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rf-ls

v0.1.7

Published

List directory and file formation

Downloads

127

Readme

rf-ls

List file and directory information in an easy to use format. Similar to the linux command ls.

NPM version NPM downloads NPM license

Dependency Status Dev Dependency Status

Installation

npm i rf-ls

Usage

let ls = require('rf-ls');

console.log(ls('test/sample/*'));
// this gives the following output:

[{
  full: 'test/sample/logo_orange.png',
  path: 'test/sample',
  file: 'logo_orange.png',
  name: 'logo_orange',
  type: 'file',  // directory, file, link, blockDevice, characterDevice, socket
  extension: 'png', // the extension if it is a file
  size: '16.5 kB',
  sizeBytes: 16929,
  blksize: 4096,
  rights: '-rw-r--r--',
  owner: { read: true, write: true, execute: false },
  group: { read: true, write: false, execute: false },
  others: { read: true, write: false, execute: false },
  accessTime: '2019-03-21T10:33:09.622Z',
  modifyTime: '2019-02-21T15:49:57.000Z',
  changeTime: '2019-03-21T10:33:09.618Z',
  creationTime: '2019-03-21T10:33:09.618Z'
},{
  full: 'test/sample/logo_orange.svg',
  path: 'test/sample',
  file: 'logo_orange.svg',
  name: 'logo_orange',
  type: 'file',
  extension: 'svg',
  size: '1.2 kB',
  sizeBytes: 1197,
  blksize: 4096,
  rights: '-rw-r--r--',
  owner: { read: true, write: true, execute: false },
  group: { read: true, write: false, execute: false },
  others: { read: true, write: false, execute: false },
  accessTime: '2019-03-21T10:33:09.810Z',
  modifyTime: '2019-02-21T15:49:58.000Z',
  changeTime: '2019-03-21T10:33:09.618Z',
  creationTime: '2019-03-21T10:33:09.618Z'
}]

ToDo

  • module is forked from npm package "ls"; currently only the first argument "path" is working. Further options might be : Move recursive through folders, select only certain filetypes with regex.
  • Built in an async version.
  • better tests

from the 'ls' Readme:

The only required argument is the initial path, the rest can be omitted.

ls([path/s], {config}, /file regex/, iteratorFunction)

Each file produces an object with the following parameters:

  • full: The path and file (/foo/bar/baz.jpg)

  • path: The path to the file (/foo/bar/)

  • file: The file (baz.jpg)

  • name: The file without an extension (baz)

  • recurse: Should we recurse into directories? (Boolean, default is false)

  • type: What kind of files should we return? ('all', 'dir', 'file', default is 'all')

The /regex/ will only return matching files. All directories will still be recursed.

The iterator function is mostly a style preference, but can be handy if you need to throw an error and stop traversal.

Testing

node test.js

This will log the output to your console.

License

This is module is a fork of the module 'ls' https://github.com/awnist/ls/blob/master/README.md It is licensed under the same terms: UNLICENSED. Do whatever you want with it.