aboutsummaryrefslogtreecommitdiff
path: root/sandbox/testAppNevena/Front/node_modules/@npmcli/move-file
diff options
context:
space:
mode:
authorDanijel Andjelkovic <adanijel99@gmail.com>2022-03-01 21:54:41 +0100
committerDanijel Andjelkovic <adanijel99@gmail.com>2022-03-01 21:54:41 +0100
commit6c8128f9fd5a5d0be115806c35a21b3d683df8d6 (patch)
treef46c2f6b3b9b294ff32bd75c08ccdc9e7a8cc4ef /sandbox/testAppNevena/Front/node_modules/@npmcli/move-file
parent2400b84e95913665da6279114168148444b8f9ab (diff)
parent7d3640f824f46490b47bd95f1c5a16644f712068 (diff)
Merge branch 'dev' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into logo
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/@npmcli/move-file')
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/move-file/LICENSE.md22
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/move-file/README.md69
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/move-file/index.js162
-rw-r--r--sandbox/testAppNevena/Front/node_modules/@npmcli/move-file/package.json34
4 files changed, 287 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/move-file/LICENSE.md b/sandbox/testAppNevena/Front/node_modules/@npmcli/move-file/LICENSE.md
new file mode 100644
index 00000000..072bf208
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/move-file/LICENSE.md
@@ -0,0 +1,22 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
+Copyright (c) npm, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/move-file/README.md b/sandbox/testAppNevena/Front/node_modules/@npmcli/move-file/README.md
new file mode 100644
index 00000000..8a5a57f0
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/move-file/README.md
@@ -0,0 +1,69 @@
+# @npmcli/move-file
+
+A fork of [move-file](https://github.com/sindresorhus/move-file) with
+compatibility with all node 10.x versions.
+
+> Move a file (or directory)
+
+The built-in
+[`fs.rename()`](https://nodejs.org/api/fs.html#fs_fs_rename_oldpath_newpath_callback)
+is just a JavaScript wrapper for the C `rename(2)` function, which doesn't
+support moving files across partitions or devices. This module is what you
+would have expected `fs.rename()` to be.
+
+## Highlights
+
+- Promise API.
+- Supports moving a file across partitions and devices.
+- Optionally prevent overwriting an existing file.
+- Creates non-existent destination directories for you.
+- Support for Node versions that lack built-in recursive `fs.mkdir()`
+- Automatically recurses when source is a directory.
+
+## Install
+
+```
+$ npm install @npmcli/move-file
+```
+
+## Usage
+
+```js
+const moveFile = require('@npmcli/move-file');
+
+(async () => {
+ await moveFile('source/unicorn.png', 'destination/unicorn.png');
+ console.log('The file has been moved');
+})();
+```
+
+## API
+
+### moveFile(source, destination, options?)
+
+Returns a `Promise` that resolves when the file has been moved.
+
+### moveFile.sync(source, destination, options?)
+
+#### source
+
+Type: `string`
+
+File, or directory, you want to move.
+
+#### destination
+
+Type: `string`
+
+Where you want the file or directory moved.
+
+#### options
+
+Type: `object`
+
+##### overwrite
+
+Type: `boolean`\
+Default: `true`
+
+Overwrite existing destination file(s).
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/move-file/index.js b/sandbox/testAppNevena/Front/node_modules/@npmcli/move-file/index.js
new file mode 100644
index 00000000..95d1888c
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/move-file/index.js
@@ -0,0 +1,162 @@
+const { dirname, join, resolve, relative, isAbsolute } = require('path')
+const rimraf_ = require('rimraf')
+const { promisify } = require('util')
+const {
+ access: access_,
+ accessSync,
+ copyFile: copyFile_,
+ copyFileSync,
+ unlink: unlink_,
+ unlinkSync,
+ readdir: readdir_,
+ readdirSync,
+ rename: rename_,
+ renameSync,
+ stat: stat_,
+ statSync,
+ lstat: lstat_,
+ lstatSync,
+ symlink: symlink_,
+ symlinkSync,
+ readlink: readlink_,
+ readlinkSync
+} = require('fs')
+
+const access = promisify(access_)
+const copyFile = promisify(copyFile_)
+const unlink = promisify(unlink_)
+const readdir = promisify(readdir_)
+const rename = promisify(rename_)
+const stat = promisify(stat_)
+const lstat = promisify(lstat_)
+const symlink = promisify(symlink_)
+const readlink = promisify(readlink_)
+const rimraf = promisify(rimraf_)
+const rimrafSync = rimraf_.sync
+
+const mkdirp = require('mkdirp')
+
+const pathExists = async path => {
+ try {
+ await access(path)
+ return true
+ } catch (er) {
+ return er.code !== 'ENOENT'
+ }
+}
+
+const pathExistsSync = path => {
+ try {
+ accessSync(path)
+ return true
+ } catch (er) {
+ return er.code !== 'ENOENT'
+ }
+}
+
+const moveFile = async (source, destination, options = {}, root = true, symlinks = []) => {
+ if (!source || !destination) {
+ throw new TypeError('`source` and `destination` file required')
+ }
+
+ options = {
+ overwrite: true,
+ ...options
+ }
+
+ if (!options.overwrite && await pathExists(destination)) {
+ throw new Error(`The destination file exists: ${destination}`)
+ }
+
+ await mkdirp(dirname(destination))
+
+ try {
+ await rename(source, destination)
+ } catch (error) {
+ if (error.code === 'EXDEV' || error.code === 'EPERM') {
+ const sourceStat = await lstat(source)
+ if (sourceStat.isDirectory()) {
+ const files = await readdir(source)
+ await Promise.all(files.map((file) => moveFile(join(source, file), join(destination, file), options, false, symlinks)))
+ } else if (sourceStat.isSymbolicLink()) {
+ symlinks.push({ source, destination })
+ } else {
+ await copyFile(source, destination)
+ }
+ } else {
+ throw error
+ }
+ }
+
+ if (root) {
+ await Promise.all(symlinks.map(async ({ source, destination }) => {
+ let target = await readlink(source)
+ // junction symlinks in windows will be absolute paths, so we need to make sure they point to the destination
+ if (isAbsolute(target))
+ target = resolve(destination, relative(source, target))
+ // try to determine what the actual file is so we can create the correct type of symlink in windows
+ let targetStat
+ try {
+ targetStat = await stat(resolve(dirname(source), target))
+ } catch (err) {}
+ await symlink(target, destination, targetStat && targetStat.isDirectory() ? 'junction' : 'file')
+ }))
+ await rimraf(source)
+ }
+}
+
+const moveFileSync = (source, destination, options = {}, root = true, symlinks = []) => {
+ if (!source || !destination) {
+ throw new TypeError('`source` and `destination` file required')
+ }
+
+ options = {
+ overwrite: true,
+ ...options
+ }
+
+ if (!options.overwrite && pathExistsSync(destination)) {
+ throw new Error(`The destination file exists: ${destination}`)
+ }
+
+ mkdirp.sync(dirname(destination))
+
+ try {
+ renameSync(source, destination)
+ } catch (error) {
+ if (error.code === 'EXDEV' || error.code === 'EPERM') {
+ const sourceStat = lstatSync(source)
+ if (sourceStat.isDirectory()) {
+ const files = readdirSync(source)
+ for (const file of files) {
+ moveFileSync(join(source, file), join(destination, file), options, false, symlinks)
+ }
+ } else if (sourceStat.isSymbolicLink()) {
+ symlinks.push({ source, destination })
+ } else {
+ copyFileSync(source, destination)
+ }
+ } else {
+ throw error
+ }
+ }
+
+ if (root) {
+ for (const { source, destination } of symlinks) {
+ let target = readlinkSync(source)
+ // junction symlinks in windows will be absolute paths, so we need to make sure they point to the destination
+ if (isAbsolute(target))
+ target = resolve(destination, relative(source, target))
+ // try to determine what the actual file is so we can create the correct type of symlink in windows
+ let targetStat
+ try {
+ targetStat = statSync(resolve(dirname(source), target))
+ } catch (err) {}
+ symlinkSync(target, destination, targetStat && targetStat.isDirectory() ? 'junction' : 'file')
+ }
+ rimrafSync(source)
+ }
+}
+
+module.exports = moveFile
+module.exports.sync = moveFileSync
diff --git a/sandbox/testAppNevena/Front/node_modules/@npmcli/move-file/package.json b/sandbox/testAppNevena/Front/node_modules/@npmcli/move-file/package.json
new file mode 100644
index 00000000..0c066dbc
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/@npmcli/move-file/package.json
@@ -0,0 +1,34 @@
+{
+ "name": "@npmcli/move-file",
+ "version": "1.1.2",
+ "files": [
+ "index.js"
+ ],
+ "description": "move a file (fork of move-file)",
+ "dependencies": {
+ "mkdirp": "^1.0.4",
+ "rimraf": "^3.0.2"
+ },
+ "devDependencies": {
+ "require-inject": "^1.4.4",
+ "tap": "^14.10.7"
+ },
+ "scripts": {
+ "test": "tap",
+ "snap": "tap",
+ "preversion": "npm test",
+ "postversion": "npm publish",
+ "prepublishOnly": "git push origin --follow-tags"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/npm/move-file"
+ },
+ "tap": {
+ "check-coverage": true
+ },
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ }
+}