src/dropbox.js
function (path, options) {
    if (! this.connected) { return Promise.reject("not connected (path: " + path + ")"); }
    var url = 'https://content.dropboxapi.com/2/files/download';
    var self = this;

    var savedRev = this._revCache.get(path);
    if (savedRev === null) {
      // file was deleted server side
      return Promise.resolve({statusCode: 404});
    }
    if (options && options.ifNoneMatch) {
      // We must wait for local revision cache to be initialized before
      // checking if local revision is outdated
      if (! this._initialFetchDone) {
        return this.fetchDelta().then(() => {
          return this.get(path, options);
        });
      }
     
      if (savedRev && (savedRev === options.ifNoneMatch)) {
        // nothing changed.
        return Promise.resolve({statusCode: 304});
      }
    }

    //use _getFolder for folders
    if (path.substr(-1) === '/') {
      return this._getFolder(path, options);
    }


    var params = {
      headers: {
        'Dropbox-API-Arg': JSON.stringify({path: getDropboxPath(path)}),
      },
      responseType: 'arraybuffer'
    };
    if (options && options.ifNoneMatch) {
      params.headers['If-None-Match'] = options.ifNoneMatch;
    }

    return this._request('GET', url, params).then(function (resp) {
      var status = resp.status;
      var meta, body, mime, rev;
      if (status !== 200 && status !== 409) {
        return Promise.resolve({statusCode: status});
      }
      meta = resp.getResponseHeader('Dropbox-API-Result');
      //first encode the response as text, and later check if 
      //text appears to actually be binary data
      return getTextFromArrayBuffer(resp.response, 'UTF-8').then(function (responseText) {
        body = responseText;
        if (status === 409) {
          meta = body;
        }

        try {
          meta = JSON.parse(meta);
        } catch(e) {
          return Promise.reject(e);
        }

        if (status === 409) {
          if (compareApiError(meta, ['path', 'not_found'])) {
            return {statusCode: 404};
          }
          return Promise.reject(new Error('API error while downloading file ("' + path + '"): ' + meta.error_summary));
        }

        mime = resp.getResponseHeader('Content-Type');
        rev = meta.rev;
        self._revCache.set(path, rev);
        self._shareIfNeeded(path);

        if (shouldBeTreatedAsBinary(responseText, mime)) {
          //return unprocessed response 
          body = resp.response;
        } else {
          // handling json (always try)
          try {
            body = JSON.parse(body);
            mime = 'application/json; charset=UTF-8';
          } catch(e) {
            //Failed parsing Json, assume it is something else then
          }
        }

        return {
          statusCode: status, 
          body: body, 
          contentType: mime, 
          revision: rev
        }; 
      });  
    });
  }
function (path, options) {
    if (! this.connected) { return Promise.reject("not connected (path: " + path + ")"); }
    var url = 'https://content.dropboxapi.com/2/files/download';
    var self = this;

    var savedRev = this._revCache.get(path);
    if (savedRev === null) {
      // file was deleted server side
      return Promise.resolve({statusCode: 404});
    }
    if (options && options.ifNoneMatch) {
      // We must wait for local revision cache to be initialized before
      // checking if local revision is outdated
      if (! this._initialFetchDone) {
        return this.fetchDelta().then(() => {
          return this.get(path, options);
        });
      }
     
      if (savedRev && (savedRev === options.ifNoneMatch)) {
        // nothing changed.
        return Promise.resolve({statusCode: 304});
      }
    }

    //use _getFolder for folders
    if (path.substr(-1) === '/') {
      return this._getFolder(path, options);
    }


    var params = {
      headers: {
        'Dropbox-API-Arg': JSON.stringify({path: getDropboxPath(path)}),
      },
      responseType: 'arraybuffer'
    };
    if (options && options.ifNoneMatch) {
      params.headers['If-None-Match'] = options.ifNoneMatch;
    }

    return this._request('GET', url, params).then(function (resp) {
      var status = resp.status;
      var meta, body, mime, rev;
      if (status !== 200 && status !== 409) {
        return Promise.resolve({statusCode: status});
      }
      meta = resp.getResponseHeader('Dropbox-API-Result');
      //first encode the response as text, and later check if 
      //text appears to actually be binary data
      return getTextFromArrayBuffer(resp.response, 'UTF-8').then(function (responseText) {
        body = responseText;
        if (status === 409) {
          meta = body;
        }

        try {
          meta = JSON.parse(meta);
        } catch(e) {
          return Promise.reject(e);
        }

        if (status === 409) {
          if (compareApiError(meta, ['path', 'not_found'])) {
            return {statusCode: 404};
          }
          return Promise.reject(new Error('API error while downloading file ("' + path + '"): ' + meta.error_summary));
        }

        mime = resp.getResponseHeader('Content-Type');
        rev = meta.rev;
        self._revCache.set(path, rev);
        self._shareIfNeeded(path);

        if (shouldBeTreatedAsBinary(responseText, mime)) {
          //return unprocessed response 
          body = resp.response;
        } else {
          // handling json (always try)
          try {
            body = JSON.parse(body);
            mime = 'application/json; charset=UTF-8';
          } catch(e) {
            //Failed parsing Json, assume it is something else then
          }
        }

        return {
          statusCode: status, 
          body: body, 
          contentType: mime, 
          revision: rev
        }; 
      });  
    });
  }
Checks for the path in ``_revCache`` and decides based on that if file
has changed. Calls ``_getFolder`` is the path points to a folder.

Calls ``Dropbox.share`` afterwards to fill ``_itemRefs``.

Compatible with ``WireClient.get``

@param path {string} - path of the folder to get, with leading slash
@param options {Object}

@protected