How to get file name and extension from ipfs?

With command ipfs get hash i only get byte array data. How to i resolve file name and extension? Do i have to map it somewhere else with hash?

afaik, the two choices are 1) Use MFS (which has names built in) or 2) use DAG “Object Links”…

for object links you can do “object/new” to create an object to hold the file and then “object/patch/add-link”, to create a DAG links object that points to the CID with a “name” associated to it via the links. I’m not sure if MFS itself is doing this same thing under the covers or not, but if you just need to “name” an existing CID, DAT links does that.

Also there is the “wrap in directory” option for the basic “add” function, which might help, but I"m not sure how it gets an actual name in that case. Good luck. hope I helped at least some.