Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

上传返回路径 #233

Open
NewStartN opened this issue Mar 26, 2024 · 1 comment
Open

上传返回路径 #233

NewStartN opened this issue Mar 26, 2024 · 1 comment

Comments

@NewStartN
Copy link

怎么在返回的访问路径上加上文件名称啊,例如http://127.0.0.1:8080/ipfs/QmTGK9aXJsgw53eSa4CVG4zZSiDrK2mQg8Q5nVNtiYuFUR/文件名称

@odisseus
Copy link
Contributor

odisseus commented Apr 24, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants