Skip to content

VaultTransaction.copy method

VaultTransaction › copy

Copies a file or folder, recording the removal of the copy as the inverse. A folder is copied with its whole subtree, so the single recorded removal undoes the whole tree. Unlike VaultTransaction.create, the content is copied byte for byte, so a binary resource round-trips faithfully.

Parent folders that had to be created for the destination are NOT undone individually, matching VaultTransaction.create and VaultTransaction.rename.

Signature:

copy(oldPathOrFile: PathOrAbstractFile, newPath: string): Promise<string>

Parameters:

ParameterTypeDescription
oldPathOrFilePathOrAbstractFileThe path, file or folder to copy.
newPathstringThe desired new path (an available path is chosen if it is taken).

Returns: Promise<string>A Promise resolving to the actual path of the copy.