IPFS get has added some PaxHeaders, which cannot be removed by using parameters. The uploaded file content can only be obtained by filtering after obtaining the text. How to remove this PaxHeaders and subsequent string of content through commands. My requirement is to upload files through IPFSCluster using commands, which can upload text and files. To upload files, I need to use the uploaded file name and data when downloading and return them to the user
This is directly using get to retrieve the extra content from the file
This is the content I obtained after using filtering processing
You are using internal Kubo RPC /api/v0/get which is designed to work with ipfs get command-line (CLI). The ipfs get CLI uses TAR as a transport format, and will recreate files with mode and mtime if they are present in the DAG. PaxHeaders are necessary to accomplish that task. You can just ignore them if you dont need that metadata.
To retrieve data alone of a single file, without extra metadata, you can use /api/v0/cat.
Note: if you only want to retrieve data, consider using Path Gateway API instead (Kubo exposes it on different port: http://127.0.0.1:8080/ipfs/${cid}).
With Gateway API you can download single files directly by using CID or their names.
To download a directory as a TAR pass ?format=tar