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

fs.cli

v0.0.1

Published

Easy filesystem functions

Downloads

2

Readme

Easy FS Scripting With NodeJS

It is specially created to get rid of routines when writing CLI tools using NodeJS. File system. Recursive. Synchronous...

Why?

  • Looking for a way to remove directory recursively in nodejs?
  • Looking how to copy files recursively in nodejs?
  • Want to move some your files with nodejs using globs?
  • Or maybe tar/zip some dir synchronously?
  • Tired writing shell-jobs with nodejs?
  • Welcome!

Because it should be as simple as possible. Let's see by example. Assume it is required to make a script which look-ups for all available .doc files in some given directory recursively, move them to a given destination, creates tarball from it and does a clean-up.

var fs = require('fs-cli');

var temp = './doc';

fs.mv('/home/user/docs/**/*.doc', temp);
fs.tar(temp, './all-docs.tgz');
fs.rm(temp);

Oh, really? - Yeah!

Of course, it's not very error-prone to write like that. You may want to add some checks:

var fs = require('fs-cli');

var temp = './doc';

function die() {
    console.log(fs.error().stack);
    process.exit();
}

fs.mv('/home/user/docs/**/*.doc', temp) || die();
fs.tar(temp, './all-docs.tgz') || die();
fs.rm(temp) || die();

-- Simple? Short? Cross-platform? Synchronous? Recursive? FS? JavaScript? -- Yeah! That's why! -- But... NodeJS has Sync versions of fs functions... -- We know, we use them inside. But not always...

Do you like that, want to help? Welcome!

Install

npm install fs-cli

Use

var fs = require('fs-cli');

What Does It Can

  • ls: directory listing
  • rm: remove given path with all its contents, globs are allowed
  • mv: move source to destination, create missing paths recursive, +globs
  • cp: copy recursive, globs are allowed
  • mkdir: create path recursively
  • chmod/rchmod: change permissions/do it recursive, globs allowed
  • chown/rchown: change owner/do it recursive, globs are welcome
  • touch: touch, just touch... ah, will create missing path also
  • tar/untar: yup. tar. untar. paths as usual, would be created
  • zip/unzip: see above, the same, but zip
  • readfile/writefile: whenever you need, read, write, all sync, autopaths
  • open/read/write/close: big files? well...
  • exists: checks if exists, return file system object stats if exists
  • relpath/realpath: paths transform, cross-platform, exists-free

Want More?

Coming soon...

Achtung!

All thease stuff is highly experimental and non bugs-free. It is under an active development, so use it at your own risk! One day we may change everything here. You warned.

License - ISC

Copyright (c) 2015, Mykhailo Stadnyk

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.