happy-opfs
    Preparing search index...

    Function move

    • Moves a file or directory from one location to another. Both source and destination must be of the same type (both files or both directories).

      With { overwrite: false } the move follows mv -n semantics: when the destination already exists the operation is a no-op, leaving both the destination and the source untouched. The source is only removed once the transfer has actually happened, so a skipped move can never destroy data.

      Parameters

      • srcPath: string

        The absolute source path.

      • destPath: string

        The absolute destination path.

      • Optionaloptions: MoveOptions

        Optional move options.

        Options for move.

        • Optionaloverwrite?: boolean

          Whether to overwrite the destination file if it already exists.

          When false, the move is a no-op if the destination already exists (mv -n style): both the destination and the source are left untouched.

          true

      Returns AsyncVoidIOResult

      A promise that resolves to an AsyncVoidIOResult indicating success or failure.

      1.8.0

      copy for copying instead of moving

      // Move/rename a file
      await move('/old/path/file.txt', '/new/path/file.txt');

      // Move a directory
      await move('/old/folder', '/new/folder');

      // Keep both files when the destination already exists
      await move('/old/file.txt', '/new/file.txt', { overwrite: false });