Can I `name publish` multiple objects under different human readable names?

From @Gozala on Fri Dec 16 2016 20:01:39 GMT+0000 (UTC)

After reading a white paper (specifically section 3.6.8 Path Lookup Performance) I got an impression that I could use /ipns/${my_node_id} as namespace for creating mutable index of the immutable content. Or in other words my assumption was that I could publish specific IPFS objects under human-readable names. So for example if I have app1 and app2 with id’s ${app1_id} and {app2_id} I should be able to publish them under: /ipns/${my_node_id}/${app1_id} and /ipns/${my_node_id}/${app2_id} but I can’t figure out how to do that. From what I can tell I can just publish single object as /ipns/${my_node_id} which could be a directory containing app_1 and app_2 to somewhat accomplish what I’m trying, but then I think it’s actually will be a different object that will contain equivalent content rather than just pointers to specific objects.

What I really wish I could do is to have an equivalent of git branches so I could just update update pointers to new versions of app1 and app2 so something like:

ipfs name publish app1 ${app1_id} # Published to ${my_node_id}/app1: ${app1_id}
ipfs name publish app2 ${app2_id} # Published to ${my_node_id}/app2: ${app2_id}


ipfs name publish app1 ${app1_id_v2} # Published to ${my_node_id}/app1: ${app1_id_v2}
```<br /><br /><i>Copied from original issue: https://github.com/ipfs/support/issues/46</i>

From @Kubuxu on Fri Dec 16 2016 20:25:47 GMT+0000 (UTC)

You are 100% right when you say you could use directories, and it is precisely what you should do.

but then I think it’s actually will be a different object that will contain equivalent content rather than just pointers to specific objects.

This doesn’t matter at all.


To accomplish what you want to do you can use Files API. It works as follows:

H1=$(ipfs add -q "$MY_APP1")
ipfs rm -r /app1 || true # always delete, doesn't matter if it doesn't exist, cp -f would be better but doesn't exist yet
ipfs cp /ipfs/$(H1) /app1
ipfs name publish $(ipfs files stat --hash /)

You can repeat it with app2 instead of app1.
I think it will accomplish what you want to do.