Socket
Socket
Sign inDemoInstall

mv

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mv

fs.rename but works across devices. same as the unix utility 'mv'


Version published
Weekly downloads
2.3M
decreased by-4.22%
Maintainers
1
Weekly downloads
 
Created

What is mv?

The 'mv' npm package is used for moving files and directories in Node.js. It provides a simple API to move files and directories, with options to overwrite existing files and create directories if they do not exist.

What are mv's main functionalities?

Move a file

This feature allows you to move a file from one location to another. The code sample demonstrates moving 'source.txt' to 'destination.txt'.

const mv = require('mv');

mv('source.txt', 'destination.txt', function(err) {
  if (err) throw err;
  console.log('File moved successfully');
});

Move a directory

This feature allows you to move a directory from one location to another. The 'mkdirp' option ensures that the destination directory is created if it does not exist.

const mv = require('mv');

mv('sourceDir', 'destinationDir', {mkdirp: true}, function(err) {
  if (err) throw err;
  console.log('Directory moved successfully');
});

Overwrite existing files

This feature allows you to overwrite existing files at the destination. The 'clobber' option is set to true to enable overwriting.

const mv = require('mv');

mv('source.txt', 'destination.txt', {clobber: true}, function(err) {
  if (err) throw err;
  console.log('File moved and overwritten successfully');
});

Other packages similar to mv

Keywords

FAQs

Package last updated on 22 Jun 2015

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