超广告结构中的pdf是否有任何大小限制?

时间:2017-11-07 10:33:37

标签: hyperledger-fabric hyperledger hyperledger-composer

我使用hyperledger面料和作曲家创建了小poc。 在我的项目中,我正在上传2个文件, 第一次上传文件,但是当我尝试上传相同大小的第二个文件时,它在作曲家中显示错误

  

请求POST / api / UpdateContractDetails的未处理错误:错误:请求实体太大       在readStream(/home/ttandale/.nvm/versions/node/v6.11.2/lib/node_modules/composer-rest-server/node_modules/raw-body/index.js:196:17)       at getRawBody(/home/ttandale/.nvm/versions/node/v6.11.2/lib/node_modules/composer-rest-server/node_modules/raw-body/index.js:106:12)       在阅读(/home/ttandale/.nvm/versions/node/v6.11.2/lib/node_modules/composer-rest-server/node_modules/body-parser/lib/read.js:76:3)       在jsonParser(/home/ttandale/.nvm/versions/node/v6.11.2/lib/node_modules/composer-rest-server/node_modules/body-parser/lib/types/json.js:127:5)       在Layer.handle [as handle_request](/home/ttandale/.nvm/versions/node/v6.11.2/lib/node_modules/composer-rest-server/node_modules/express/lib/router/layer.js:95:5 )       在trim_prefix(/home/ttandale/.nvm/versions/node/v6.11.2/lib/node_modules/composer-rest-server/node_modules/express/lib/router/index.js:317:13)       at /home/ttandale/.nvm/versions/node/v6.11.2/lib/node_modules/composer-rest-server/node_modules/express/lib/router/index.js:284:7       在Function.process_params(/home/ttandale/.nvm/versions/node/v6.11.2/lib/node_modules/composer-rest-server/node_modules/express/lib/router/index.js:335:12)       在下一个(/home/ttandale/.nvm/versions/node/v6.11.2/lib/node_modules/composer-rest-server/node_modules/express/lib/router/index.js:275:10)       at /home/ttandale/.nvm/versions/node/v6.11.2/lib/node_modules/composer-rest-server/node_modules/loopback/server/middleware/token.js:130:7       at /home/ttandale/.nvm/versions/node/v6.11.2/lib/node_modules/composer-rest-server/node_modules/loopback/common/models/access-token.js:108:15       at /home/ttandale/.nvm/versions/node/v6.11.2/lib/node_modules/composer-rest-server/node_modules/loopback/common/models/access-token.js:171:11       at _combinedTickCallback(internal / process / next_tick.js:73:7)       at process._tickCallback(internal / process / next_tick.js:104:9)

1 个答案:

答案 0 :(得分:2)

从技术上讲,这是一个Node问题。使用Javascript,例如。 fs.readFileSync(‘yourimageFile.jpg’).toString(‘base64’);,您应该能够将代码转换为Base64字符串。您可以为所选(建模的资产类型等)字段定义“字符串”以在Hyperledger Composer中托管。理论上说,一旦它是一个字符串,它就像任何其他字符串一样被发送到链代码。

这些链接可能有所帮助:

- > https://www.thepolyglotdeveloper.com/2016/02/convert-an-uploaded-image-to-a-base64-string-in-node-js/

- > https://belltane.wordpress.com/2017/03/27/storing-images-in-hyperledger-fabric-blockchain/