Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
增加了对多种类型post数据的支持,
现在可以使用https://github.com/koajs/koala/blob/master/docs/body-parsing.md#content-negotiation这个方式来进行处理post数据。
同时将上面的方案集成到了
lark
中,具体方案如下:增加
* this.request.body()
函数,在启用parser的情况下,yield this.request.body()
能根据数据的类型做处理,返回对应的结果。不过由于
image/*
和multipart
类型中会有文件,yield this.request.body()
会将这些文件转换成Buffer
,可能会造成内存占用过高。所以对于这种情况,既可以通过配置的方式disable掉parse的工作,直接对stream进行操作,也可以在调用
yield this.request.body()
前设置this.request.saveAs = function (readabel) { ... }
来设置保存的路径计算方式,这样lark
会自行将上传对文件按照saveAs
计算的路径保存到本地方案效果
结果
@zezhou 看看方案是否ok