Pike v8.0 release 1738

Method Stdio.async_cp()


Method async_cp

void async_cp(string from, string to, function(int, mixed ... :void) callback, mixed ... args)

Description

Copy a file asynchronously.

This function is similar to cp(), but works asynchronously.

Parameter from

Name of file to copy.

Parameter to

Name of file to create or replace with a copy of from.

Parameter callback

Function to be called on completion. The first argument will be 1 on success, and 0 (zero) otherwise. The rest of the arguments to callback are passed verbatim from args.

Parameter args

Extra arguments to pass to callback.

Note

For callback to be called, the backend must be active (ie main() must have returned -1, or Pike.DefaultBackend get called in some other way). The actual copying may start before the backend has activated.

Bugs

Currently the file sizes are not compared, so the destination file (to) may be truncated.

See also

cp(), sendfile()