How to use the dropbox.DropboxClient function in dropbox

To help you get started, we’ve selected a few dropbox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github enyojs / ares-project / hermes / dropbox / routes / put.js View on Github external
exports.route = function(req, res) {
	var auth_token = req.param("token"),
		auth_secret = req.param("secret"),
		content = req.param("content"),
		path = req.params[0];
	//
	path = path.replace(/\s$/, '');
	//
	console.log('');
	console.log('');
	console.log("request put: ", auth_token, auth_secret, path);
	console.log("config: ", config);
	console.log(content.length + " chars");
	//
	var dropbox = new DropboxClient(config.key, config.secret, auth_token, auth_secret);
	dropbox.put(content || '', path, function() {
		res.send("{response: 'ok'}");
	});
};
github enyojs / ares-project / hermes / dropbox / routes / list.js View on Github external
exports.route = function(req, res) {
	var auth_token = req.param("token"),
		auth_secret = req.param("secret"),
		path = req.params[0];
	//
	console.log('');
	console.log('');
	console.log("request list: ", auth_token, auth_secret, path);
	console.log("config: ", config);
	//console.log(req.params);
	//
	var dropbox = new DropboxClient(config.key, config.secret, auth_token, auth_secret);
	//
	list(dropbox, path, function(inErr, inResponse) {
		console.log("response: ", inErr || inResponse);
		res.send(inErr || inResponse);
	});
};
github enyojs / ares-project / hermes / dropbox / routes / get.js View on Github external
exports.route = function(req, res) {
	var auth_token = req.param("token"),
		auth_secret = req.param("secret"),
		path = req.params[0];
	//
	console.log('');
	console.log('');
	console.log("request get: ", auth_token, auth_secret, path);
	console.log("config: ", config);
	//console.log(req.params);
	//
	var dropbox = new DropboxClient(config.key, config.secret, auth_token, auth_secret);
	//
	var request = dropbox.getFileStream(path);
	request.on('response', function(response) {
		response.pipe(res);
	});
	request.on('error', function(response) {
		response.send("error");
	});
	request.end();
};
github LockerProject / Locker / Connectors / Dropbox / dropbox.js View on Github external
lfs.readObjectFromFile('auth.json', function(auth) {
        if(auth.token) dapp = new dbox(auth.key, auth.ksecret, auth.token, auth.tsecret);
        app.listen(processInfo.port,function() {
            var returnedInfo = {port: processInfo.port};
            console.log(JSON.stringify(returnedInfo));
        });
    });
github LockerProject / Locker / Connectors / Dropbox / dropbox.js View on Github external
app.get('/init', function(req, res) {
    if(!req.param('email') || !req.param('pass') || !req.param('key') || !req.param('secret') ) {
        res.writeHead(400);
        res.end('whats the creds yo?');
        return;
    }
    console.log("initializing for "+req.param('email') );
    dapp = new dbox(req.param('key'), req.param('secret'));
    dapp.getAccessToken(req.param('email'), req.param('pass'), function(err, token, secret){
        if(err)
        {
            res.writeHead(500);
            res.end("failed: "+JSON.stringify(err));
            return;
        }
        fs.writeFileSync('auth.json', JSON.stringify({key:req.param('key'), ksecret:req.param('secret'), token:token, tsecret:secret}));
        res.writeHead(200, {'Content-Type': 'text/html'});
        res.end("saved access token "+token+", <a href="./">continue</a>");        
    });
});
github enyojs / ares-project / hermes / dropbox / routes / auth.js View on Github external
function connect(inUser, inPassword, next) {
	new Dropbox(config.key, config.secret)
		.getAccessToken(inUser, inPassword,
			function(err, token, secret) {
				next(err, {token: token, secret: secret});
			}
		);
}

dropbox

The Dropbox JavaScript SDK is a lightweight, promise based interface to the Dropbox v2 API that works in both nodejs and browser environments.

MIT
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis