Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getPercentCompleted returns only 0 and 100 #87

Open
sushibear opened this issue Mar 11, 2021 · 0 comments
Open

getPercentCompleted returns only 0 and 100 #87

sushibear opened this issue Mar 11, 2021 · 0 comments

Comments

@sushibear
Copy link

sushibear commented Mar 11, 2021

Hey there...

I was just trying to async upload a larger video file following your example here:
https://github.com/hobigo/nextcloud-node-client/blob/master/docs/upload.md

But the console log only returns 0 or 100 when using the getPercentCompleted() command?

My Code:

let files = [{ sourceFileName: sourceFile, targetFileName: targetFile }];
let uc = new UploadFilesCommand(newClient, { files });
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);
}

Here is my output:
0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 100% [ '/video.mp4' ] 80275042

Or is this correct and it only returns IF the command UploadFilesCommand was completed? Sounds weird to me and is not really what I would expect. I would like to show the percentage of the file in progress.

@sushibear sushibear changed the title getPercentCompleted return only 0 and 100 getPercentCompleted returns only 0 and 100 Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant