diff --git a/fileloader.js b/fileloader.js index aaae9de..c509c02 100644 --- a/fileloader.js +++ b/fileloader.js @@ -42,7 +42,8 @@ module.exports = { if (wo?.ipfsStore) { // 为了在这里使用 wo.ipfsStore.add, 需要提供 FileContent,不能直接用 req.file // 20230312: not working with nodejs above (not including) 18.2.1! https://github.com/nodejs/node/issues/46221 - const { cid } = await wo.ipfsStore.add(ipfsProvider.globSource(_file.path), { + const { cid } = await wo.ipfsStore.add(ipfsProvider.globSource(_file.path, ''), { + // 20230713 不知为何,今天在本机测试时,ipfs-core 报错 Pattern must be a string,之前没有过这个问题。跟踪后发现 ipfs-core 0.14.3 代码里 第二个参数 patter 必须是 string,于是添加第二个参数为 '',现在可以上传文件给本地的 ipfs-core 了。经测试,加不加这个参数都不影响 ipfs-http-client 运行。 cidVersion: 1, hashAlg: 'sha2-256', onlyHash: false, // 多个备份是好的,而且能加快下次添加同样文件的速度。