Skip to content

fixes to addFile and Container construction #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/cloudfiles/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ var Container = exports.Container = function (client, details) {
if (!details) {
throw new Error("Container must be constructed with at least basic details.")
}
if(typeof details !== 'object') {
details = {name: details};
}

this.files = [];
this.client = client;
Expand All @@ -20,7 +23,16 @@ var Container = exports.Container = function (client, details) {

Container.prototype = {
addFile: function (file, local, options, callback) {
return this.client.addFile(this.name, file, local, options, callback);
if(!options && !callback) {
options = {};
}
if (typeof options === 'function' && !callback) {
callback = options;
options = {};
}
options.remote = file;
options.local = local;
return this.client.addFile(this.name, options, callback);
},

destroy: function (callback) {
Expand Down