Permalink
Browse files

Add marker option to getFiles

Add the option to set a marker on a getFiles request in order to be
able to paginate beyond 10000 objects from the Rackspace API.
  • Loading branch information...
1 parent aa48a77 commit 0559b216d4452568bdcea6cfe753e32f3d40c1c5 @davidbanham committed Apr 18, 2012
Showing with 9 additions and 2 deletions.
  1. +9 −2 lib/cloudfiles/core.js
View
11 lib/cloudfiles/core.js
@@ -15,6 +15,7 @@ var http = require('http'),
request = require('request'),
cloudfiles = require('../cloudfiles'),
config = require('./config'),
+ querystring = require('querystring'),
common = require('./common');
//
@@ -235,7 +236,7 @@ Cloudfiles.prototype.destroyContainer = function (container, callback) {
});
};
-Cloudfiles.prototype.getFiles = function (container, download, callback) {
+Cloudfiles.prototype.getFiles = function (container, marker, download, callback) {
var self = this;
//
@@ -250,7 +251,13 @@ Cloudfiles.prototype.getFiles = function (container, download, callback) {
download = false;
}
- common.rackspace(this.storageUrl(container, true), this, callback, function (body) {
+ if (typeof marker === 'string') {
+ var storUrl = this.storageUrl(container, true)+'&'+querystring.stringify({marker: marker});
+ } else {
+ var storUrl = this.storageUrl(container, true);
+ }
+
+ common.rackspace(storUrl, this, callback, function (body) {
var files = JSON.parse(body);
// If download == false or wasn't defined

0 comments on commit 0559b21

Please sign in to comment.