在上传文件时,即使设置了“设置具有”选项,文件哈希也不会返回:
var options = {
hash: "md5",
container : `${bucket}/${prefix}`
};
Container.upload(req, res, options, (err, result) => {
result.files ... do not contains hash
}
在lib / storage-handler.js文件中,我发现了这一点:
var file = {
container: container,
name: part.filename,
type: part.mime,
field: part.name,
};
覆盖了可怕的原始实现:
var file = new File({
path: this._uploadPath(part.filename),
name: part.filename,
type: part.mime,
hash: self.hash
});
有人建议使用loopback-component-storage获取哈希吗?