Skip to main content

copy-files

Description

Fires when copying a file or folder within File Manager

Usage

"copy-files": ({
ids: string [],
target: string,
newIds?: string []
}) => boolean | void;

Parameters

The callback of the copy-files action takes an object with the following parameters:

  • ids - (required) an array with IDs of files or folders that are copied
  • target - (required) the ID of a folder where files or folders a copied to
  • newIds - (optional) new generated Ids of files after being copied (the readonly parameter, it's not recommended to set this parameter manually when calling actions)

Returning false from the event handler will block the operation, which you can do via the api.intercept() method.

Example

<script>
import { getData, getDrive } from "./common/data";
import { Filemanager } from "wx-svelte-filemanager";

let api;

$: if (api) {
api.on("copy-files", ({ ids, target }) => {
console.log(`Files ${ids.join(", ")} were copied to ${target}`);
});
};

</script>

<Filemanager data={getData()} drive={getDrive()} bind:api />

Related articles: How to access File Manager API