nextcloud-node-client
Version:
Nextcloud client API for node.js TypeScript applications
41 lines (40 loc) • 1.43 kB
TypeScript
import Client, { File, SourceTargetFileNames } from "./client";
import Command from "./command";
/**
* options to create a upload folder command
*/
export interface UploadFolderCommandOptions {
/**
* The name of the sourece folder with the file structure to be uploaded
*/
folderName: string;
/**
* the funtion to determine the target file name having the sourece file name.
* If the file should not be uploaded, return an empty string
* @param {SourceTargetFileNames} fileNames
*/
getTargetFileNameBeforeUpload?: (fileNames: SourceTargetFileNames) => string;
processFileAfterUpload?: (file: File) => Promise<void>;
}
/**
* Command to upload the contents of a folder from local file system to nextcloud recursivley
*/
export default class UploadFolderCommand extends Command {
private folderName;
private processFileAfterUpload?;
private getTargetFileNameBeforeUpload;
private bytesUploaded;
/**
* @param {Client} client the client
* @param {ISourceTargetFileNames[]} files the files to be uploaded
* @param {(file: File) => void} processAfterUpload callback function to process the uploaded file
*/
constructor(client: Client, options: UploadFolderCommandOptions);
/**
* execute the command
* @async
* @returns {Promise<void>}
*/
protected onExecute(): Promise<void>;
getBytesUploaded(): number;
}