import Client , { File , CommandResultMetaData , CommandStatus , UploadFilesCommand , SourceTargetFileNames , } from "../client" ; ( async ( ) => { const client = new Client ( ) ; const files = [ { sourceFileName : "c:\\Users\\holger\\Documents\\GitHub\\nextcloud-node-client\\src\\test\\data\\Borstenson\\Company\\Borstenson Company Profile.pdf" , targetFileName : "/Company Information/Borstenson Company Profile.pdf" } , ] ; const processFileAfterUpload = async ( file ) : Promise < void > => { await file . addTag ( "Company" ) ; await file . addComment ( `Hello ${ file . baseName } your mime type is ${ file . mime }` ) ; return ; } ; const uc = new UploadFilesCommand ( client , { files , processFileAfterUpload } ) ; uc . execute ( ) ; while ( uc . isFinished ( ) !== true ) { await ( async ( ) => { return new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ; } ) ( ) ; console . log ( uc . getPercentCompleted ( ) + "%" ) ; } const uploadResult = uc . getResultMetaData ( ) ; if ( uc . getStatus ( ) === CommandStatus . success ) { console . log ( uploadResult . messages ) ; console . log ( uc . getBytesUploaded ( ) ) ; } else { console . log ( uploadResult . errors ) ; } } ) ( ) ;