{"action":"closed","number":22,"pull_request":{"url":"https://api.github.com/repos/ipfs/node-ipfs-api/pulls/22","id":36899740,"html_url":"https://github.com/ipfs/node-ipfs-api/pull/22","diff_url":"https://github.com/ipfs/node-ipfs-api/pull/22.diff","patch_url":"https://github.com/ipfs/node-ipfs-api/pull/22.patch","issue_url":"https://api.github.com/repos/ipfs/node-ipfs-api/issues/22","number":22,"state":"closed","locked":false,"title":"Add streams and directory building","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},"body":"This PR adds stream support for any command send data through the `files` argument of send. It addresses issue #4 and #3. \r\n\r\nAppropriate values for any `files` argument are streams, vinyl files, or buffers. Any stream or buffer will be converted to a vinyl file with the `cwd`, `base`, and `path` set to `/`, which basically is just an unnamed file.\r\n\r\nThe base of any filename is the relative pathing from the vinyl file `base`.\r\n\r\nWrapped files in a directory\r\n-----------------------------------\r\n```javascript\r\nfiles.push(new File({\r\n\tbase: '/',\r\n\tpath: '/base/dir/hello.txt',\r\n\tcontents: new Buffer(\"world\")\r\n}))\r\n\r\nfiles.push(new File({\r\n\tbase: '/',\r\n\tpath: '/base/dir/ipfs.txt',\r\n\tcontents: new Buffer(\"is cool\")\r\n}))\r\n\r\nfiles.push(new File({\r\n\tbase: '/',\r\n\tpath: '/base/readme.md',\r\n\tcontents: new Buffer(\"wow\")\r\n}))\r\n\r\nfiles.push(new File({\r\n\tbase: '/',\r\n\tpath: '/base/dir/other/readme.md',\r\n\tcontents: new Buffer(\"wow\")\r\n}))\r\n```\r\n\r\n```\r\n{\r\n  \"Name\": \"base/readme.md\",\r\n  \"Hash\": \"QmbxMp5x7RbqHSTrrKQCYjccw2obvgcz2GEyz3gEkixhDS\"\r\n}\r\n{\r\n  \"Name\": \"base/dir/hello.txt\",\r\n  \"Hash\": \"QmNyJpQkU1cEkBwMDhDNFstr42q55mqG5GE5Mgwug4xyGk\"\r\n}\r\n{\r\n  \"Name\": \"base/dir/ipfs.txt\",\r\n  \"Hash\": \"QmfBfWxn32sGXbkgDoeNLT5rBcTehYffMyeU5LFTTByt6V\"\r\n}\r\n{\r\n  \"Name\": \"base/dir/other/readme.md\",\r\n  \"Hash\": \"QmbxMp5x7RbqHSTrrKQCYjccw2obvgcz2GEyz3gEkixhDS\"\r\n}\r\n{\r\n  \"Name\": \"base/dir/other\",\r\n  \"Hash\": \"QmSV3qfAxjMTdGrB5tGA4daPsL6NoZKxhUx6QxCfqLCeGp\"\r\n}\r\n{\r\n  \"Name\": \"base/dir\",\r\n  \"Hash\": \"QmeE8ZjMwexLbZBAX1dxwguCaQ5xyHw4wYGmGiyfzEqL2p\"\r\n}\r\n{\r\n  \"Name\": \"base\",\r\n  \"Hash\": \"QmeUg1UYEAmrZZWW7URFZXMYMVECzfmgdgke95F8HqauLz\"\r\n}\r\n```\r\nGrouping of files\r\n-----------------------------------\r\n```javascript\r\nfiles.push(new File({\r\n\tbase: '/base/',\r\n\tpath: '/base/dir/hello.txt',\r\n\tcontents: new Buffer(\"world\")\r\n}))\r\n\r\nfiles.push(new File({\r\n\tbase: '/base/',\r\n\tpath: '/base/dir/ipfs.txt',\r\n\tcontents: new Buffer(\"is cool\")\r\n}))\r\n\r\nfiles.push(new File({\r\n\tbase: '/base/',\r\n\tpath: '/base/readme.md',\r\n\tcontents: new Buffer(\"wow\")\r\n}))\r\n\r\nfiles.push(new File({\r\n\tbase: '/base/',\r\n\tpath: '/base/dir/other/readme.md',\r\n\tcontents: new Buffer(\"wow\")\r\n}))\r\n```\r\n\r\n```\r\n{\r\n  \"Name\": \"readme.md\",\r\n  \"Hash\": \"QmbxMp5x7RbqHSTrrKQCYjccw2obvgcz2GEyz3gEkixhDS\"\r\n}\r\n{\r\n  \"Name\": \"dir/hello.txt\",\r\n  \"Hash\": \"QmNyJpQkU1cEkBwMDhDNFstr42q55mqG5GE5Mgwug4xyGk\"\r\n}\r\n{\r\n  \"Name\": \"dir/ipfs.txt\",\r\n  \"Hash\": \"QmfBfWxn32sGXbkgDoeNLT5rBcTehYffMyeU5LFTTByt6V\"\r\n}\r\n{\r\n  \"Name\": \"dir/other/readme.md\",\r\n  \"Hash\": \"QmbxMp5x7RbqHSTrrKQCYjccw2obvgcz2GEyz3gEkixhDS\"\r\n}\r\n{\r\n  \"Name\": \"dir/other\",\r\n  \"Hash\": \"QmSV3qfAxjMTdGrB5tGA4daPsL6NoZKxhUx6QxCfqLCeGp\"\r\n}\r\n{\r\n  \"Name\": \"dir\",\r\n  \"Hash\": \"QmeE8ZjMwexLbZBAX1dxwguCaQ5xyHw4wYGmGiyfzEqL2p\"\r\n}\r\n```\r\n\r\n*Note: this is slight different from what was shown in #3.","created_at":"2015-06-04T03:37:25Z","updated_at":"2015-06-04T11:45:05Z","closed_at":"2015-06-04T11:45:05Z","merged_at":"2015-06-04T11:45:05Z","merge_commit_sha":"0580718eafd79cc8e3f4736642b613968e4158eb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ipfs/node-ipfs-api/pulls/22/commits","review_comments_url":"https://api.github.com/repos/ipfs/node-ipfs-api/pulls/22/comments","review_comment_url":"https://api.github.com/repos/ipfs/node-ipfs-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ipfs/node-ipfs-api/issues/22/comments","statuses_url":"https://api.github.com/repos/ipfs/node-ipfs-api/statuses/7a99c6b0ca681f354c49024794af1ef80d57e5be","head":{"label":"ipfs:feat/streams","ref":"feat/streams","sha":"7a99c6b0ca681f354c49024794af1ef80d57e5be","user":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars.githubusercontent.com/u/10536621?v=3","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"repo":{"id":24031839,"name":"node-ipfs-api","full_name":"ipfs/node-ipfs-api","owner":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars.githubusercontent.com/u/10536621?v=3","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ipfs/node-ipfs-api","description":"A node client library for the IPFS API","fork":false,"url":"https://api.github.com/repos/ipfs/node-ipfs-api","forks_url":"https://api.github.com/repos/ipfs/node-ipfs-api/forks","keys_url":"https://api.github.com/repos/ipfs/node-ipfs-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ipfs/node-ipfs-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ipfs/node-ipfs-api/teams","hooks_url":"https://api.github.com/repos/ipfs/node-ipfs-api/hooks","issue_events_url":"https://api.github.com/repos/ipfs/node-ipfs-api/issues/events{/number}","events_url":"https://api.github.com/repos/ipfs/node-ipfs-api/events","assignees_url":"https://api.github.com/repos/ipfs/node-ipfs-api/assignees{/user}","branches_url":"https://api.github.com/repos/ipfs/node-ipfs-api/branches{/branch}","tags_url":"https://api.github.com/repos/ipfs/node-ipfs-api/tags","blobs_url":"https://api.github.com/repos/ipfs/node-ipfs-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ipfs/node-ipfs-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ipfs/node-ipfs-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/ipfs/node-ipfs-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ipfs/node-ipfs-api/statuses/{sha}","languages_url":"https://api.github.com/repos/ipfs/node-ipfs-api/languages","stargazers_url":"https://api.github.com/repos/ipfs/node-ipfs-api/stargazers","contributors_url":"https://api.github.com/repos/ipfs/node-ipfs-api/contributors","subscribers_url":"https://api.github.com/repos/ipfs/node-ipfs-api/subscribers","subscription_url":"https://api.github.com/repos/ipfs/node-ipfs-api/subscription","commits_url":"https://api.github.com/repos/ipfs/node-ipfs-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/ipfs/node-ipfs-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/ipfs/node-ipfs-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/ipfs/node-ipfs-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/ipfs/node-ipfs-api/contents/{+path}","compare_url":"https://api.github.com/repos/ipfs/node-ipfs-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ipfs/node-ipfs-api/merges","archive_url":"https://api.github.com/repos/ipfs/node-ipfs-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ipfs/node-ipfs-api/downloads","issues_url":"https://api.github.com/repos/ipfs/node-ipfs-api/issues{/number}","pulls_url":"https://api.github.com/repos/ipfs/node-ipfs-api/pulls{/number}","milestones_url":"https://api.github.com/repos/ipfs/node-ipfs-api/milestones{/number}","notifications_url":"https://api.github.com/repos/ipfs/node-ipfs-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ipfs/node-ipfs-api/labels{/name}","releases_url":"https://api.github.com/repos/ipfs/node-ipfs-api/releases{/id}","created_at":"2014-09-14T19:57:50Z","updated_at":"2015-06-01T11:07:23Z","pushed_at":"2015-06-04T11:45:05Z","git_url":"git://github.com/ipfs/node-ipfs-api.git","ssh_url":"git@github.com:ipfs/node-ipfs-api.git","clone_url":"https://github.com/ipfs/node-ipfs-api.git","svn_url":"https://github.com/ipfs/node-ipfs-api","homepage":"","size":572,"stargazers_count":9,"watchers_count":9,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":4,"forks":8,"open_issues":4,"watchers":9,"default_branch":"master"}},"base":{"label":"ipfs:master","ref":"master","sha":"68c401f587c7b1ca925d4ada798d8171b87723b6","user":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars.githubusercontent.com/u/10536621?v=3","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"repo":{"id":24031839,"name":"node-ipfs-api","full_name":"ipfs/node-ipfs-api","owner":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars.githubusercontent.com/u/10536621?v=3","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ipfs/node-ipfs-api","description":"A node client library for the IPFS API","fork":false,"url":"https://api.github.com/repos/ipfs/node-ipfs-api","forks_url":"https://api.github.com/repos/ipfs/node-ipfs-api/forks","keys_url":"https://api.github.com/repos/ipfs/node-ipfs-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ipfs/node-ipfs-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ipfs/node-ipfs-api/teams","hooks_url":"https://api.github.com/repos/ipfs/node-ipfs-api/hooks","issue_events_url":"https://api.github.com/repos/ipfs/node-ipfs-api/issues/events{/number}","events_url":"https://api.github.com/repos/ipfs/node-ipfs-api/events","assignees_url":"https://api.github.com/repos/ipfs/node-ipfs-api/assignees{/user}","branches_url":"https://api.github.com/repos/ipfs/node-ipfs-api/branches{/branch}","tags_url":"https://api.github.com/repos/ipfs/node-ipfs-api/tags","blobs_url":"https://api.github.com/repos/ipfs/node-ipfs-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ipfs/node-ipfs-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ipfs/node-ipfs-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/ipfs/node-ipfs-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ipfs/node-ipfs-api/statuses/{sha}","languages_url":"https://api.github.com/repos/ipfs/node-ipfs-api/languages","stargazers_url":"https://api.github.com/repos/ipfs/node-ipfs-api/stargazers","contributors_url":"https://api.github.com/repos/ipfs/node-ipfs-api/contributors","subscribers_url":"https://api.github.com/repos/ipfs/node-ipfs-api/subscribers","subscription_url":"https://api.github.com/repos/ipfs/node-ipfs-api/subscription","commits_url":"https://api.github.com/repos/ipfs/node-ipfs-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/ipfs/node-ipfs-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/ipfs/node-ipfs-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/ipfs/node-ipfs-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/ipfs/node-ipfs-api/contents/{+path}","compare_url":"https://api.github.com/repos/ipfs/node-ipfs-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ipfs/node-ipfs-api/merges","archive_url":"https://api.github.com/repos/ipfs/node-ipfs-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ipfs/node-ipfs-api/downloads","issues_url":"https://api.github.com/repos/ipfs/node-ipfs-api/issues{/number}","pulls_url":"https://api.github.com/repos/ipfs/node-ipfs-api/pulls{/number}","milestones_url":"https://api.github.com/repos/ipfs/node-ipfs-api/milestones{/number}","notifications_url":"https://api.github.com/repos/ipfs/node-ipfs-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ipfs/node-ipfs-api/labels{/name}","releases_url":"https://api.github.com/repos/ipfs/node-ipfs-api/releases{/id}","created_at":"2014-09-14T19:57:50Z","updated_at":"2015-06-01T11:07:23Z","pushed_at":"2015-06-04T11:45:05Z","git_url":"git://github.com/ipfs/node-ipfs-api.git","ssh_url":"git@github.com:ipfs/node-ipfs-api.git","clone_url":"https://github.com/ipfs/node-ipfs-api.git","svn_url":"https://github.com/ipfs/node-ipfs-api","homepage":"","size":572,"stargazers_count":9,"watchers_count":9,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":4,"forks":8,"open_issues":4,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ipfs/node-ipfs-api/pulls/22"},"html":{"href":"https://github.com/ipfs/node-ipfs-api/pull/22"},"issue":{"href":"https://api.github.com/repos/ipfs/node-ipfs-api/issues/22"},"comments":{"href":"https://api.github.com/repos/ipfs/node-ipfs-api/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/ipfs/node-ipfs-api/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/ipfs/node-ipfs-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ipfs/node-ipfs-api/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/ipfs/node-ipfs-api/statuses/7a99c6b0ca681f354c49024794af1ef80d57e5be"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"krl","id":59379,"avatar_url":"https://avatars.githubusercontent.com/u/59379?v=3","gravatar_id":"","url":"https://api.github.com/users/krl","html_url":"https://github.com/krl","followers_url":"https://api.github.com/users/krl/followers","following_url":"https://api.github.com/users/krl/following{/other_user}","gists_url":"https://api.github.com/users/krl/gists{/gist_id}","starred_url":"https://api.github.com/users/krl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krl/subscriptions","organizations_url":"https://api.github.com/users/krl/orgs","repos_url":"https://api.github.com/users/krl/repos","events_url":"https://api.github.com/users/krl/events{/privacy}","received_events_url":"https://api.github.com/users/krl/received_events","type":"User","site_admin":false},"comments":2,"review_comments":0,"commits":6,"additions":152,"deletions":43,"changed_files":4}}