Skip to content

Conversation

@ikbear
Copy link
Contributor

@ikbear ikbear commented Dec 31, 2012

No description provided.

lib/rs.js Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么有 key、filename,两者有啥不同?传 filename 目的是啥?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里 multipart/form-data 上传的时候使用了 formstream 这个包:https://github.com/fengmk2/formstream ,上传 stream 的时候需要用到 filename:https://github.com/fengmk2/formstream/blob/master/lib/formstream.js#L134 。key 用于上传的时候组装"action"中的"EncodedEntryURI": http://docs.qiniutek.com/v3/api/io/#upload-file-by-multipart

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

通常而言,key 里面应该就有 filename 呀。比如 key 是 foo/bar.jpg,那么 filename 可能就取 bar.jpg

@ikbear ikbear closed this Jan 9, 2013
@ikbear ikbear reopened this Jan 9, 2013
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fd 不需要 close 么?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要。我加上。

lib/util.js Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参数同时具备 crc32 + enableCrc32Check 的语义,叫 enableCrc32Check 很奇怪,应该是叫 crc32 会比较好。因为 enableCrc32Check == false 只是 crc32 的一个特殊值。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已更新。这里确实应该改成 crc32 值,rs.uploadWithToken() 这个函数接收的也是一个 crc32 值。但是 rs.uploadFileWithToken() 这个函数接收的就是一个判断是否开启crc32校验的enableCrc32Check值,因为它自身可以从传入的文件来计算它的crc32值。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需了解些 nodejs 的报错惯例。

qiniu pushed a commit that referenced this pull request Jan 15, 2013
@qiniu qiniu merged commit 6236e5e into qiniu:master Jan 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants