quickblox-javascript-sdk
                                
                                 quickblox-javascript-sdk copied to clipboard
                                
                                    quickblox-javascript-sdk copied to clipboard
                            
                            
                            
                        download attachents with content functions
 
 

When i use
<a href="privateUrl" download> <img="privateUrl" /> </a>

How i can download attachments (pdf / image / docs)?? please help
Hi @hi-kuldeep . You can try following code to download attachment(s):
const privateUrl = QB.content.privateUrl('your file id');
const [url, token] = privateUrl.split('?token=');
fetch(url + '.json', {
  headers: { 'QB-Token': token }
})
.then(res => res.blob())
.then(blob => {
  const a = document.createElement('a');
  const blobUrl = URL.createObjectURL(blob);
  a.href = URL.createObjectURL(blob);
  document.body.appendChild(a);
  a.click();
  document.body.removeChild(a);
  URL.revokeObjectURL(blobUrl);
})