Skip to content

Allow adding directories via curl #3153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
knupfer opened this issue Aug 30, 2016 · 9 comments
Open

Allow adding directories via curl #3153

knupfer opened this issue Aug 30, 2016 · 9 comments
Labels
help wanted Seeking public contribution on this issue status/deferred Conscious decision to pause or backlog

Comments

@knupfer
Copy link

knupfer commented Aug 30, 2016

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.

@knupfer
Copy link
Author

knupfer commented Aug 30, 2016

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

@jbenet
Copy link
Member

jbenet commented Aug 30, 2016

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.

@jbenet
Copy link
Member

jbenet commented Aug 30, 2016

you may have to untar yourself, then pipe it into an ipfs add (multipart, i think) stream

@ghost
Copy link

ghost commented Aug 30, 2016

I've successfully piped docker image tarballs into ipfs tar add in the
past

@ghost
Copy link

ghost commented Aug 30, 2016

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.

@knupfer
Copy link
Author

knupfer commented Aug 30, 2016

I'll give it a try, didn't think about that.

@whyrusleeping
Copy link
Member

It would be pretty nice to have an 'inverse' of ipfs get --archive. @knupfer what would an ideal API look like for you here?

@knupfer
Copy link
Author

knupfer commented Sep 1, 2016

Perhaps ipfs add --archive ? I like symmetries a lot.

@whyrusleeping
Copy link
Member

@knupfer I really like that. ipfs add --archive could take a tar stream as input data.

@whyrusleeping whyrusleeping added the help wanted Seeking public contribution on this issue label Sep 14, 2016
@flyingzumwalt flyingzumwalt added the status/deferred Conscious decision to pause or backlog label Sep 26, 2016
@whyrusleeping whyrusleeping added this to the Ipfs 0.4.12 milestone Sep 3, 2017
@Kubuxu Kubuxu modified the milestones: Ipfs 0.4.12, go-ipfs 0.4.13 Nov 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Seeking public contribution on this issue status/deferred Conscious decision to pause or backlog
Projects
None yet
Development

No branches or pull requests

5 participants