Skip to content

Instantly share code, notes, and snippets.

@beanmoss
Created April 14, 2016 16:12
Show Gist options
  • Save beanmoss/12980dacf27dc209a0724d4d2a288757 to your computer and use it in GitHub Desktop.
Save beanmoss/12980dacf27dc209a0724d4d2a288757 to your computer and use it in GitHub Desktop.
Dropbox read file and serve it to the browser.
var Dropbox = require("dropbox");
var fs = require("fs");
var config = require('../config');
var client = new Dropbox.Client(config.dropbox);
getFile: function (file, res) {
client.readFile(file,{ buffer: true }, function (error, result) {
if (error) {
console.log(error);
}
console.log(result);
res.end(result);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment