Open NewStartN opened 4 months ago
If you want the file name to be stored in the DAG, you have to enclose your file within a directory. To do that, call setWrapWithDirectory()
on your AddArgs.Builder
:
AddArgs args = AddArgs.Builder.newInstance()
.setWrapWithDirectory()
.build();
List<MerkleNode> tree = ipfs.add(file, args);
See the documentation for the Kubo RPC API.
Alternatively, just append the filename you want to the end of your file URL: http://[gateway]/ipfs/[hash]?filename=[your file name]
See the documentation for the HTTP gateway.
怎么在返回的访问路径上加上文件名称啊,例如http://127.0.0.1:8080/ipfs/QmTGK9aXJsgw53eSa4CVG4zZSiDrK2mQg8Q5nVNtiYuFUR/文件名称