We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

pouic's avatar
pouic
Helpful | Level 6
7 years ago

Api v2 for filesGetThumbnail gives t.buffer not a function error

Hi, when i try to get thumbnail for any file inside my folder i have the same error for different types os files (svg, png, ...)     import { Dropbox } from 'dropbox'; let dbx = new Dropbox...
  • pouic's avatar
    pouic
    7 years ago

    If import the DropboxSDK library like script import on my html works fine ;)

     

    my solution: 

     

    index.html ( add dropbox-sdk manually)

      <script src="assets/js/dropbox-sdk.js"></script>

    On page where can use dropbox (index.ts)

    declare var Dropbox: any;
    
    
      var dbx = new Dropbox.Dropbox({ accessToken: 'MY-KEY' });
       
        dbx.filesListFolder({path: '/my-folder-name'})
          .then(function(response) {
    
           dbx.filesGetThumbnail({ path: response.entries[0].path_display, format: 'png', size: 'w128h128' })
            .then(function(response) {
              var img = document.createElement('img');
              img.src=window.URL.createObjectURL(response.fileBlob);
              document.getElementById('results').appendChild(img);
    
            })
            .catch(function(error) {
              console.log(error);
            });
          
        });
      }