Code Monkey home page Code Monkey logo

Comments (3)

greg-db avatar greg-db commented on June 2, 2024 1

Thanks for the report! I just tried reproducing this with that version of node and dropbox but it worked for me:

% cat test_1065.js
const packageDetails = require('./package.json');
console.log('node version: ', process.version);
console.log('dependencies: ', packageDetails.dependencies);


const Dropbox = require('dropbox').Dropbox;

const dbx = new Dropbox({accessToken: '<ACCESS_TOKEN_REDACTED>'})

var imgPath = "/test.jpg";
dbx.filesDownload({ path: imgPath })
  .then(function(response) {
    console.log(response);
  })
  .catch(function(error) {
    console.error(error);
  });

% node test_1065.js
node version:  v18.12.1
dependencies:  { dropbox: '^10.34.0' }
DropboxResponse {
  status: 200,
  headers: Headers {
    [Symbol(map)]: [Object: null prototype] {
      'accept-ranges': [Array],
      'cache-control': [Array],
      'dropbox-api-result': [Array],
      etag: [Array],
      'original-content-length': [Array],
      'x-server-response-time': [Array],
      'content-type': [Array],
      'accept-encoding': [Array],
      date: [Array],
      server: [Array],
      'strict-transport-security': [Array],
      'x-robots-tag': [Array],
      'content-length': [Array],
      'x-dropbox-response-origin': [Array],
      'x-dropbox-request-id': [Array],
      connection: [Array]
    }
  },
  result: {
    name: 'test.jpg',
    path_lower: '/test.jpg',
    path_display: '/test.jpg',
    id: 'id:25N5ksooX-sAAAAAAAMlGA',
    client_modified: '2021-06-04T15:47:12Z',
    server_modified: '2021-06-04T15:47:13Z',
    rev: '5c3f29afd81e4021eccc7',
    size: 7570,
    media_info: { '.tag': 'metadata', metadata: [Object] },
    is_downloadable: true,
    content_hash: '03ee18416f5171e7ff7dff9a9355efa3db3cfa4afe36a995720ec54f68b20f95',
    fileBinary: <Buffer ff d8 ff e0 00 10 4a 46 49 46 00 01 01 00 00 01 00 01 00 00 ff e1 09 ad 68 74 74 70 3a 2f 2f 6e 73 2e 61 64 6f 62 65 2e 63 6f 6d 2f 78 61 70 2f 31 2e ... 7520 more bytes>
  }
}

Can you share more specific steps/code for reproducing this? Thanks in advance!

from dropbox-sdk-js.

jereloh avatar jereloh commented on June 2, 2024

Thanks your code works well.

To clarify, I was using

const dbx = new Dropbox({
  fetch,
  clientId: process.env.DROPBOX_CLIENT_ID,
  clientSecret: process.env.DROPBOX_CLIENT_SECRET,
})
dbx.auth.setRefreshToken(process.env.DROPBOX_REFRESH_TOKEN)

following example from here
Instead of the method from your example:

const dbx = new Dropbox({accessToken: '<ACCESS_TOKEN_REDACTED>'})

from dropbox-sdk-js.

jereloh avatar jereloh commented on June 2, 2024

I'm not sure why the method from the dropbox forum didn't work in newer node versions v18/ v20

But as i browsed the official docs, the recommended usage is of what @greg-db shared.
I shall close this.

from dropbox-sdk-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.