Skip to content

Develop #89

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

Merged
merged 2 commits into from
Dec 5, 2013
Merged
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
9 changes: 4 additions & 5 deletions qiniu/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ function PutExtra(params, mimeType, crc32, checkCrc) {
function PutRet(hash, key) {
this.hash = hash || null;
this.key = key || null;
}
}

// onret: callback function instead of ret
// onret: callback function instead of ret
function put(uptoken, key, body, extra, onret) {
if(!extra) {
extra = new PutExtra();
Expand Down Expand Up @@ -59,8 +59,8 @@ function getMultipart(uptoken, key, body, extra) {
if(key != exports.UNDEFINED_KEY) {
form.field('key', key);
}

form.buffer('file', new Buffer(body), key, extra.mimeType);
var buf = Buffer.isBuffer(body) ? body : new Buffer(body);
form.buffer('file', buf, key, extra.mimeType);

//extra['checkcrc']
if (extra.checkCrc == 1) {
Expand Down Expand Up @@ -100,4 +100,3 @@ function putFile(uptoken, key, loadFile, extra, onret) {
function putFileWithoutKey(uptoken, loadFile, extra, onret) {
putFile(uptoken, null, loadFile, extra, onret);
}