Drafts Script Reference

Dropbox

Dropbox objects can be used to work with files in a Dropbox account.

Properties

Functions

Class Functions

Examples

// create Dropbox object
var db = Dropbox.create();

// setup variables
var path = "/test/file.txt";
var content = "text to place in file";

// write to file on Dropbox
var success = db.write(path, content, "add", true);

if (success) { // write worked!
  var dbContent = db.read(path);
  if (dbContent) { // read worked!
    if (dbContent == content) {
      alert("File contents match!");
    }
    else {
      console.log("File did not match");
      context.fail();
    }
  }
  else { // read failed, log error
    console.log(db.lastError);
    context.fail();
  }
}
else { // write failed, log error
  console.log(db.lastError);
  context.fail();
}