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

on upload progress #125

Open
joyjames143 opened this issue Dec 21, 2022 · 1 comment
Open

on upload progress #125

joyjames143 opened this issue Dec 21, 2022 · 1 comment

Comments

@joyjames143
Copy link

I want to know how to code in such a way that the onUploadProgress works because in my code the file is getting uploaded but I can't able to get the upload progress

the below is my code for uploading a file

router.post("/uploadvideo", upload.single('file') ,async(req,res)=>{
let b2 = new B2({
applicationKeyId: 'my-app-id',
applicationKey: 'my-app-key'
});
await b2.authorize();
const file = req.file;
const result = await b2.getUploadUrl('my-bucket-id');
let resultdata = result.data
const dictionary = new Map(Object.entries(resultdata));

b2.uploadFile({
    fileName: 'video4.zip', 
    data: file.buffer,
    bucketId: 'boss-cloud',
    uploadUrl:dictionary.get("uploadUrl"),
    uploadAuthToken:dictionary.get("authorizationToken"),
    onUploadProgress: function (event) {
      console.log("joker")
        console.log(`Upload progress: ${event.percent}%`)
    }
  }).then((response) => {
    console.log("uploaded")
    return res.send("uploaded")
  }).catch((error) => {
    console.error(error);
  });

})

in this code, I am able to upload any file but I can't able to get the upload progress

it is a node.js application and I am using "Backblaze-b2": "^1.7.0".

the same issue for the download progress code also I am ale to download ut not able to see the download progress while downloading

I want to know how to get the upload progress and download progress

can I get it? if so then how?

if not? why can't I get it

@joyjames143 joyjames143 changed the title on upload progress on upload progress Dec 21, 2022
@nkwelleepiengomejr
Copy link

Same here

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

2 participants