File.prototype.copy()

Make a deep copy of a file.

Syntax

file.copy(placement uint32, target File, name string, placeholder uint8) File

Parameters

placement uint32

Where to place the new file relative the the target. One of [os.BEFORE, os.AFTER, os.PREPEND, os.APPEND]. See file placement for more details.

target File

Place the copied file relative to this one.

name string

File’s name. It is an error to use special characters like spaces. Providing an empty string defaults to using the name of the source file.

placeholder uint8

Which placeholder to place the file in.

Description

Make a deep copy of referenced file and place it in the filesystem relative to the target file. The returned file does not need to be explicitely stored, every file operation is automatically commited to disk once the transaction successfully exits.

Examples

Basic example, make a copy after self.

Placement os.PREPEND.

Placement os.APPEND.

Placement os.BEFORE.

Placement os.AFTER.

All arguments must be provided

It is invalid to use spaces or special chars in the name.