{"action":"created","issue":{"url":"https://api.github.com/repos/ipfs/js-ipfs-api/issues/173","repository_url":"https://api.github.com/repos/ipfs/js-ipfs-api","labels_url":"https://api.github.com/repos/ipfs/js-ipfs-api/issues/173/labels{/name}","comments_url":"https://api.github.com/repos/ipfs/js-ipfs-api/issues/173/comments","events_url":"https://api.github.com/repos/ipfs/js-ipfs-api/issues/173/events","html_url":"https://github.com/ipfs/js-ipfs-api/issues/173","id":123230812,"number":173,"title":"getFileStream does not properly create directories","user":{"login":"travisperson","id":165274,"avatar_url":"https://avatars.githubusercontent.com/u/165274?v=3","gravatar_id":"","url":"https://api.github.com/users/travisperson","html_url":"https://github.com/travisperson","followers_url":"https://api.github.com/users/travisperson/followers","following_url":"https://api.github.com/users/travisperson/following{/other_user}","gists_url":"https://api.github.com/users/travisperson/gists{/gist_id}","starred_url":"https://api.github.com/users/travisperson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/travisperson/subscriptions","organizations_url":"https://api.github.com/users/travisperson/orgs","repos_url":"https://api.github.com/users/travisperson/repos","events_url":"https://api.github.com/users/travisperson/events{/privacy}","received_events_url":"https://api.github.com/users/travisperson/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-21T08:30:25Z","updated_at":"2016-04-17T20:21:03Z","closed_at":"2016-04-17T20:21:03Z","body":"Currently in `go-ipfs v0.4.0` providing the directory structure is required. `getFileStream` does not create the directory struchure right now as it simply pushes on the files as leafs, the actual path to those files never gets created in the multipart.\r\n\r\nSee https://github.com/ipfs/go-ipfs/issues/2110\r\n\r\nThis can be seen pretty easily with:\r\n\r\n```javascript\r\nvar files = []\r\n\r\nfiles.push({\r\n    cwd:  '/base/',\r\n    base: '/base/',\r\n    path: '/base/path/to/a/dir/hello.txt',\r\n    contents: new Buffer(\"world\")\r\n})\r\n\r\nipfs.add(files, function (err, dat) {\r\n    console.log(err, dat)\r\n})\r\n```\r\n\r\n```\r\n => POST /api/v0/add?stream-channels=true HTTP/1.1\r\n => User-Agent: /node-ipfs-api/2.10.1/\r\n => Content-Type: multipart/form-data; boundary=1xjpsamsgqhvvx6rdvodt5wfyxnljtt9dbdqoffgl4s1nhfr6x4dj7jfxz4lhaor\r\n => Host: localhost:8888\r\n => Connection: close\r\n => Transfer-Encoding: chunked\r\n => \r\n => 44\r\n => --1xjpsamsgqhvvx6rdvodt5wfyxnljtt9dbdqoffgl4s1nhfr6x4dj7jfxz4lhaor\r\n => \r\n => 6e\r\n => Content-Disposition: file; filename=\"path/to/a/dir/hello.txt\"\r\n => Content-Type: application/octet-stream\r\n => \r\n => world\r\n => 46\r\n => \r\n => --1xjpsamsgqhvvx6rdvodt5wfyxnljtt9dbdqoffgl4s1nhfr6x4dj7jfxz4lhaor--\r\n => 0\r\n => \r\n => \r\n<= HTTP/1.1 200 OK\r\n<= Content-Type: application/json\r\n<= Trailer: X-Stream-Error\r\n<= Transfer-Encoding: chunked\r\n<= X-Chunked-Output: 1\r\n<= Date: Mon, 21 Dec 2015 08:29:06 GMT\r\n<= Connection: close\r\n<= Transfer-Encoding: chunked\r\n<= \r\n<= 0\r\n<= X-Stream-Error: file does not exist\r\n<= \r\n<= \r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/ipfs/js-ipfs-api/issues/comments/211107503","html_url":"https://github.com/ipfs/js-ipfs-api/issues/173#issuecomment-211107503","issue_url":"https://api.github.com/repos/ipfs/js-ipfs-api/issues/173","id":211107503,"user":{"login":"diasdavid","id":1211152,"avatar_url":"https://avatars.githubusercontent.com/u/1211152?v=3","gravatar_id":"","url":"https://api.github.com/users/diasdavid","html_url":"https://github.com/diasdavid","followers_url":"https://api.github.com/users/diasdavid/followers","following_url":"https://api.github.com/users/diasdavid/following{/other_user}","gists_url":"https://api.github.com/users/diasdavid/gists{/gist_id}","starred_url":"https://api.github.com/users/diasdavid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diasdavid/subscriptions","organizations_url":"https://api.github.com/users/diasdavid/orgs","repos_url":"https://api.github.com/users/diasdavid/repos","events_url":"https://api.github.com/users/diasdavid/events{/privacy}","received_events_url":"https://api.github.com/users/diasdavid/received_events","type":"User","site_admin":false},"created_at":"2016-04-17T20:21:03Z","updated_at":"2016-04-17T20:21:03Z","body":"Closing this issue. @travisperson if the issue persists, let's open it again."}}