Socket
Socket
Sign inDemoInstall

move-concurrently

Package Overview
Dependencies
28
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    move-concurrently

Promises of moves of files or directories with rename, falling back to recursive rename/copy on EXDEV errors, with configurable concurrency and win32 junction support.


Version published
Weekly downloads
5.5M
increased by3.06%
Maintainers
1
Install size
491 kB
Created
Weekly downloads
 

Package description

What is move-concurrently?

The move-concurrently npm package is designed to move files or directories from one location to another efficiently and safely, even under heavy loads or when dealing with a large number of files. It leverages concurrency to speed up the move operation while ensuring data integrity.

What are move-concurrently's main functionalities?

Moving files or directories concurrently

This feature allows you to move files or directories from one location to another using concurrency for improved performance. The function returns a promise, making it easy to handle completion or errors.

const move = require('move-concurrently');
move('/path/to/source', '/path/to/dest').then(() => console.log('Move complete!')).catch(console.error);

Other packages similar to move-concurrently

Readme

Source

move-concurrently

Move files and directories.

const move = require('move-concurrently')
move('/path/to/thing', '/new/path/thing').then(() => {
  // thing is now moved!
}).catch(err => {
  // oh no!
})

Uses rename to move things as fast as possible.

If you move across devices or on filesystems that don't support renaming large directories. That is, situations that result in rename returning the EXDEV error, then move will fallback to copy + delete.

When recursively copying directories it will first try to rename the contents before falling back to copying. While this will be slightly slower in true cross-device scenarios, it is MUCH faster in cases where the filesystem can't handle directory renames.

When copying ownership is maintained when running as root. Permissions are always maintained. On Windows, if symlinks are unavailable then junctions will be used.

INTERFACE

move(from, to, options) → Promise

Recursively moves from to to and resolves its promise when finished. If to already exists then the promise will be rejected with an EEXIST error.

Starts by trying to rename from to to.

Options are:

  • maxConcurrency – (Default: 1) The maximum number of concurrent copies to do at once.
  • isWindows - (Default: process.platform === 'win32') If true enables Windows symlink semantics. This requires an extra stat to determine if the destination of a symlink is a file or directory. If symlinking a directory fails then we'll try making a junction instead.

Options can also include dependency injection:

  • Promise - (Default: global.Promise) The promise implementation to use, defaults to Node's.
  • fs - (Default: require('fs')) The filesystem module to use. Can be used to use graceful-fs or to inject a mock.
  • writeStreamAtomic - (Default: require('fs-write-stream-atomic')) The implementation of writeStreamAtomic to use. Used to inject a mock.
  • getuid - (Default: process.getuid) A function that returns the current UID. Used to inject a mock.

Keywords

FAQs

Last updated on 16 Mar 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc