Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

77 lines (50 sloc) 2.57 KB


An OAuth-enabled node.js client for working with the Dropbox API.


dropbox-node depends on node-oauth.

To install via npm

npm install dropbox

To install by hand, download the module and create a symlink in ~/.node_libraries

$ ln -s /path/to/dropbox-node/ ~/.node_libraries/dropbox-node


To start, you'll need to grab a consumer key and secret from

OAuth credentials and object construction

First construct an OAuth client and acquire a valid access token and access token secret pair.

var sys = require('sys'),
    DropboxClient = require('dropbox-node').DropboxClient,
    OAuth = require('oauth').OAuth,
    oauth = new OAuth('',
                      consumer_key, consumer_secret,
                      '1.0', null, 'HMAC-SHA1')

Now create a DropboxClient object.

var dropbox = new DropboxClient(oauth, access_token, access_token_secret)

Calling API methods

dropbox-node provides methods covering each of the Dropbox API methods, excluding access token acquisition and account creation.

For example, to fetch and print the display name and email address associated with your account:

dropbox.getAccountInfo(function(err, data) {
  if (err) console.log('Error: ' + sys.inspect(err))
  else {
    var data_json = eval('(' + data + ')')
    console.log(data_json.display_name + ', ' +

Here's an example where we upload a file and remotely move it around before deleting it.

// Upload foo.txt to the Dropbox root directory.
dropbox.putFile('foo.txt', '', function(err, data) {
  if (err) console.log('Error: ' + sys.inspect(err))

// Move it into the Public directory.
dropbox.move('foo.txt', 'Public/foo.txt', function(err, data) {
  if (err) console.log('Error: ' + sys.inspect(err))

// Delete the file.
dropbox.deleteItem('Public/foo.txt', function(err, data) {
  if (err) console.log('Error: ' + sys.inspect(err))


dropbox-node depends on jasmine-node for testing. Note that the currently-implemented tests are trivial at best.

Run specs with node specs.js from the root dropbox-node directory.


  • Improve test coverage.
  • Add ability to interact with application sandboxes.
Jump to Line
Something went wrong with that request. Please try again.