How to use move-file - 6 common examples

To help you get started, we’ve selected a few move-file examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sourcegraph / sourcegraph / lsif / server / src / http-server.ts View on Github external
tempFileWriteStream.on('close', resolve)
                    tempFileWriteStream.on('error', reject)
                })

                // Load a `Database` from the file to check that it's valid.
                await new JsonDatabase().load(tempFile.path, () => noopTransformer)

                // Replace the old LSIF file with the new file.
                try {
                    await fs.mkdir(STORAGE_ROOT)
                } catch (e) {
                    if (e.code !== 'EEXIST') {
                        throw e
                    }
                }
                await moveFile(tempFile.path, diskKey({ repository, commit }))

                // Evict the old `Database` from the LRU cache to cause it to pick up the new LSIF data from disk.
                dbLRU.del(diskKey({ repository, commit }))

                res.send('Upload successful.')
            })
github Nexusoft / NexusInterface / src / shared / lib / bootstrap.js View on Github external
if (
            fs
              .statSync(path.join(extractDest, element, deeperEle))
              .isDirectory()
          ) {
            const newerContents = fs.readdirSync(
              path.join(extractDest, element, deeperEle)
            );
            for (let evenDeeperEle of newerContents) {
              moveFile.sync(
                path.join(extractDest, element, deeperEle, evenDeeperEle),
                path.join(coreDataDir, element, deeperEle, evenDeeperEle)
              );
            }
          } else {
            moveFile.sync(
              path.join(extractDest, element, deeperEle),
              path.join(coreDataDir, element, deeperEle)
            );
          }
        }
      } else {
        moveFile.sync(
          path.join(extractDest, element),
          path.join(coreDataDir, element)
        );
      }
    }
    console.log('Moved Successfully');
  } catch (e) {
    console.log('Moving Extracted Content Error', e);
    throw e;
github Nexusoft / NexusInterface / src / shared / actions / bootstrap / Bootstrapper.js View on Github external
);
              for (let evenDeeperEle of newerContents) {
                moveFile.sync(
                  path.join(extractDest, element, deeperEle, evenDeeperEle),
                  path.join(coreDataDir, element, deeperEle, evenDeeperEle)
                );
              }
            } else {
              moveFile.sync(
                path.join(extractDest, element, deeperEle),
                path.join(coreDataDir, element, deeperEle)
              );
            }
          }
        } else {
          moveFile.sync(
            path.join(extractDest, element),
            path.join(coreDataDir, element)
          );
        }
      }
      console.log('Moved Successfully');
    } catch (e) {
      console.log('Moveing Extracted Content Error', e);
    }
  }
github samuelmeuli / mini-diary / src / renderer / files / fileAccess.ts View on Github external
export function moveFile(sourcePath: string, destinationPath: string): void {
	if (fileExists(destinationPath)) {
		throw Error(translations["file-exists"]);
	}
	mv.sync(sourcePath, destinationPath);
}
github Nexusoft / NexusInterface / src / shared / lib / bootstrap.js View on Github external
const recentContents = fs.readdirSync(extractDest);
  try {
    for (let element of recentContents) {
      if (fs.statSync(path.join(extractDest, element)).isDirectory()) {
        const newcontents = fs.readdirSync(path.join(extractDest, element));
        for (let deeperEle of newcontents) {
          if (
            fs
              .statSync(path.join(extractDest, element, deeperEle))
              .isDirectory()
          ) {
            const newerContents = fs.readdirSync(
              path.join(extractDest, element, deeperEle)
            );
            for (let evenDeeperEle of newerContents) {
              moveFile.sync(
                path.join(extractDest, element, deeperEle, evenDeeperEle),
                path.join(coreDataDir, element, deeperEle, evenDeeperEle)
              );
            }
          } else {
            moveFile.sync(
              path.join(extractDest, element, deeperEle),
              path.join(coreDataDir, element, deeperEle)
            );
          }
        }
      } else {
        moveFile.sync(
          path.join(extractDest, element),
          path.join(coreDataDir, element)
        );
github Nexusoft / NexusInterface / src / shared / actions / bootstrap / Bootstrapper.js View on Github external
const recentContents = fs.readdirSync(extractDest);
    try {
      for (let element of recentContents) {
        if (fs.statSync(path.join(extractDest, element)).isDirectory()) {
          const newcontents = fs.readdirSync(path.join(extractDest, element));
          for (let deeperEle of newcontents) {
            if (
              fs
                .statSync(path.join(extractDest, element, deeperEle))
                .isDirectory()
            ) {
              const newerContents = fs.readdirSync(
                path.join(extractDest, element, deeperEle)
              );
              for (let evenDeeperEle of newerContents) {
                moveFile.sync(
                  path.join(extractDest, element, deeperEle, evenDeeperEle),
                  path.join(coreDataDir, element, deeperEle, evenDeeperEle)
                );
              }
            } else {
              moveFile.sync(
                path.join(extractDest, element, deeperEle),
                path.join(coreDataDir, element, deeperEle)
              );
            }
          }
        } else {
          moveFile.sync(
            path.join(extractDest, element),
            path.join(coreDataDir, element)
          );

move-file

Move a file - Even works across devices

MIT
Latest version published 2 years ago

Package Health Score

56 / 100
Full package analysis

Popular move-file functions