New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rightclick

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rightclick

Cut, copy, paste and delete for node.js

  • 0.6.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

rightClick Build Status

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']);

As of version 0.6.0 cut now 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']);

As of version 0.6.0 copy now 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.

As of version 0.5.0 paste now 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');

Licence

MIT

Keywords

FAQs

Package last updated on 31 Mar 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc