Open knupfer opened 7 years ago
Note: I'm aware of ipfs tar add
, but it results in a non browsable path which can be only read with ipfs cat
which isn't even part of the api under port 8080
You should be able to do this already. It's how the add
command works in general. it may involve multipart. Maybe inspect the api call that go-ipfs
does when an ipfs add -r <dir>
command happens. or look at https://github.com/ipfs/js-ipfs-api.
I tried looking in docs.ipfs.apiary.io/#reference/add but i'm getting lost / didnt find a clear example with a directory + many files.
you may have to untar yourself, then pipe it into an ipfs add
(multipart, i think) stream
~~I've successfully piped docker image tarballs into ipfs tar add
in the
past~~
eh sorry disregard my other comment.
Another idea: the hash of an empty unixfs directory is currently QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn (it'll change with IPLD), you can use that to build your directory, iterating over all children, patching them into the directory.
What @jbenet said about untar'ing as multipart into /api/v0/add might be better.
I'll give it a try, didn't think about that.
It would be pretty nice to have an 'inverse' of ipfs get --archive
. @knupfer what would an ideal API look like for you here?
Perhaps ipfs add --archive
? I like symmetries a lot.
@knupfer I really like that. ipfs add --archive
could take a tar stream as input data.
Version/Platform/Processor information (from
ipfs version --all
):go-ipfs version: 0.4.3-dev-b5fbc01 Repo version: 4 System version: amd64/linux Golang version: go1.6.2
Type (bug, feature, meta, test failure, question):
feature
Area (api, commands, daemon, fuse, etc):
api
Priority (from P0: functioning, to P4: operations on fire):
Description:
Provide a command, which takes a tarball, untars it and adds the untared content to ipfs. This is useful to be able to add directories to ipfs via curl.