Closed openpokergame closed 5 months ago
curl -X POST "http://127.0.0.1:5001/api/v0/get?arg=/ipfs/QmQWM1qDPasxm5sXAQeVMfmhnECBzyYkLgfK23yPif1Ftx&output=/root/dev/kubo/cmd/ipfs/filem.mp4&progress=true" can't save file to /root/dev/kubo/cmd/ipfs/filem.mp4, why?
curl
can't write to your local machine and the HTTP API for the daemon doesn't directly do the writing. Instead what happens when you do ipfs get
is it runs a kubo RPC client that:
So the output and progress are likely not things you want if you're just trying to save the file locally since they will . If you want fancier processing you can look at the RPC API clients in Go, JS, etc.
The likely easiest way for you to do fetching of a video locally via an HTTP API is to use the gateway API (e.g. curl http://127.0.0.1:8080/ipfs/<cid> > myfile.mp4
).
how can I download file via the rpc api?
@bitbytedance for trustless or deserialized retrieval over HTTP, you should use HTTP Gateway on port 8080 (see https://docs.ipfs.tech/reference/http/gateway/). Gateway, unlike RPC, uses correct HTTP GET
method and you benefit from HTTP Caching and resuming via HTTP Range requests.
If you are ok with not benefiting from HTTP Caching, and for some reason really, really need to use POST-based RPC for fetching a single file, you can use /api/v0/cat
with progress=false
.
For future support questions like this, please use https://discuss.ipfs.tech/c/help/13 community forum.
We try to keep github only for bugs and feature requests, thanks!.
Checklist
Installation method
built from source
Version
Config
Description
when I run the cmd: curl -X POST "http://127.0.0.1:5001/api/v0/get?arg=/ipfs/QmQWM1qDPasxm5sXAQeVMfmhnECBzyYkLgfK23yPif1Ftx&output=/root/dev/kubo/cmd/ipfs/filem.mp4&progress=true" > geturl.mp4 the output can't save file, but /root/dev/kubo/cmd/ipfs/ is exist, why? only save geturl.mp4, when I run the cmd: ipfs get /ipfs/QmQWM1qDPasxm5sXAQeVMfmhnECBzyYkLgfK23yPif1Ftx -o /root/dev/kubo/cmd/ipfs/filem.mp4 , it is can be save so: why api result geturl.mp4 != filem.mp4, Why the sizes are different?