source: trip-planner-front/node_modules/@npmcli/move-file/README.md@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[6a3a178]1# @npmcli/move-file
2
3A fork of [move-file](https://github.com/sindresorhus/move-file) with
4compatibility with all node 10.x versions.
5
6> Move a file (or directory)
7
8The built-in
9[`fs.rename()`](https://nodejs.org/api/fs.html#fs_fs_rename_oldpath_newpath_callback)
10is just a JavaScript wrapper for the C `rename(2)` function, which doesn't
11support moving files across partitions or devices. This module is what you
12would have expected `fs.rename()` to be.
13
14## Highlights
15
16- Promise API.
17- Supports moving a file across partitions and devices.
18- Optionally prevent overwriting an existing file.
19- Creates non-existent destination directories for you.
20- Support for Node versions that lack built-in recursive `fs.mkdir()`
21- Automatically recurses when source is a directory.
22
23## Install
24
25```
26$ npm install @npmcli/move-file
27```
28
29## Usage
30
31```js
32const moveFile = require('@npmcli/move-file');
33
34(async () => {
35 await moveFile('source/unicorn.png', 'destination/unicorn.png');
36 console.log('The file has been moved');
37})();
38```
39
40## API
41
42### moveFile(source, destination, options?)
43
44Returns a `Promise` that resolves when the file has been moved.
45
46### moveFile.sync(source, destination, options?)
47
48#### source
49
50Type: `string`
51
52File, or directory, you want to move.
53
54#### destination
55
56Type: `string`
57
58Where you want the file or directory moved.
59
60#### options
61
62Type: `object`
63
64##### overwrite
65
66Type: `boolean`\
67Default: `true`
68
69Overwrite existing destination file(s).
Note: See TracBrowser for help on using the repository browser.