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

rightclick

v0.7.2

Published

Cut, copy, paste and delete for node.js

Downloads

51

Readme

rightClick Build Status Dependencies

NPM

Deep cut, copy, paste & delete fuctionality for Node.js.

About

rightClick attempts to emulate the expected behaviour of mouse interactions with file systems in a programatic way. Namely cut, copy, paste & delete.

Installation

npm install rightclick

API

rightClick()

Select root folder for copy and cut operations and optionally determine encoding for copy.

rightClick('./', 'utf8');

cut()

To deep cut from the file system use:

rightClick('./myParentFolder').cut('myDesiredFileOrFolder');

This will write the full contents and structure of your target to righClick's clipboard and delete the file(s) and or folder(s) from the file system.

The argument passed to cut() can be either a string or an array of strings, such as:

rightClick('./folder').cut(['file.js', 'folder', 'otherFile.md']);

Cut accepts an optional suffix argument which can be either a string or an array. If given rightClick will cut files with the given suffix.

The following would only cut files with the suffix .js & .css from within subFolder.

rightClick('./folder').cut(['subFolder'], ['js', 'css'])

N.B. In this scenario the entirety of subFolder will be removed from the disk system but only files with the suffix .js & .css will be written to the clipboard.

copy()

To deep copy from the file system use:

rightClick('./myParentFolder').copy('myDesiredFileOrFolder');

This will write the full contents and structure of your target to rightClick's clipboard.

The argument passed to copy() can be either a string or an array of strings, such as:

rightClick('./folder').copy(['file.js', 'folder', 'otherFile.md']);

Copy accepts an optional suffix argument which can be either a string or an array. If given rightClick will copy files with the given suffix.

The following would only copy files with the suffix .js & .css from within subFolder.

rightClick('./folder').copy(['subFolder'], ['js', 'css'])

paste()

To deep paste to the file system, usually in conjunction with copy() or cut() use:

rightClick('./myParentFolder').copy('myFolder').paste('myNewDestination');

This will copy the entire contents of the clipboard to the target folder which must exist.

Paste accepts an optional force boolean. This will allow you to paste over existing folders. i.e.

rightClick('./myParentFolder').copy('myFolder').paste('myNewDestination', true);

del()

To deep delete from the file system use:

rightClick('./myParentFolder').del('myDesiredFileOrFolder');

This will delete the full contents and structure of a target folder or simply delete a file if that is the target. This is not reversable and nothing is written to the clipboard. Use with caution and certainty.

tap()

Tap allows you to insert your own methods as callbacks within rightClick's method chain. Callbacks are initiated within rightClick's scope.

To log out the clipboard you could do something like:

  rightClick('./folder')
    .copy('things')
    .tap(function () {
      console.log(this.clipboard);
    })
    .paste('./target');

Tap can also accept a function and arguments that will be applied to it, i.e:

  var func = function (a, b) {
    console.log(a + b); // 3
  };

  rightClick('./folder')
    .copy('things')
    .tap(func, 1, 2);

Licence

MIT