{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/io.js/pulls/comments/31433509","id":31433509,"diff_hunk":"@@ -0,0 +1,34 @@\n+'use strict';\n+const common = require('../common');\n+const assert = require('assert');\n+const fs = require('fs');\n+const path = require('path');\n+const stream = require('stream');\n+const firstEncoding = 'base64';\n+const secondEncoding = 'binary';\n+\n+const examplePath = path.join(common.fixturesDir, 'x.txt');\n+const dummyPath = path.join(common.tmpDir, 'x.txt');\n+\n+const exampleReadStream = fs.createReadStream(\n+  examplePath, \n+  { encoding: firstEncoding }\n+);\n+\n+const dummyWriteStream = fs.createWriteStream(\n+  dummyPath, \n+  { encoding: firstEncoding }\n+);\n+\n+exampleReadStream.pipe(dummyWriteStream).on('finish', function() {\n+  const assertWriteStream = new stream.Writable({\n+    write: function(chunk, enc, next) {\n+      const expected = new Buffer('xyz\\n');\n+      assert(chunk.equals(expected));\n+    }\n+  });\n+  assertWriteStream.setDefaultEncoding(secondEncoding);\n+  fs.createReadStream(","path":"test/parallel/test-fs-write-stream-encoding.js","position":31,"original_position":31,"commit_id":"608596c85a88f32fd2d16757a4663f1111032cf0","original_commit_id":"608596c85a88f32fd2d16757a4663f1111032cf0","user":{"login":"cjihrig","id":2512748,"avatar_url":"https://avatars.githubusercontent.com/u/2512748?v=3","gravatar_id":"","url":"https://api.github.com/users/cjihrig","html_url":"https://github.com/cjihrig","followers_url":"https://api.github.com/users/cjihrig/followers","following_url":"https://api.github.com/users/cjihrig/following{/other_user}","gists_url":"https://api.github.com/users/cjihrig/gists{/gist_id}","starred_url":"https://api.github.com/users/cjihrig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjihrig/subscriptions","organizations_url":"https://api.github.com/users/cjihrig/orgs","repos_url":"https://api.github.com/users/cjihrig/repos","events_url":"https://api.github.com/users/cjihrig/events{/privacy}","received_events_url":"https://api.github.com/users/cjihrig/received_events","type":"User","site_admin":false},"body":"And here","created_at":"2015-06-01T14:59:19Z","updated_at":"2015-06-01T14:59:19Z","html_url":"https://github.com/nodejs/io.js/pull/1844#discussion_r31433509","pull_request_url":"https://api.github.com/repos/nodejs/io.js/pulls/1844","_links":{"self":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/comments/31433509"},"html":{"href":"https://github.com/nodejs/io.js/pull/1844#discussion_r31433509"},"pull_request":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/1844"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/io.js/pulls/1844","id":36570374,"html_url":"https://github.com/nodejs/io.js/pull/1844","diff_url":"https://github.com/nodejs/io.js/pull/1844.diff","patch_url":"https://github.com/nodejs/io.js/pull/1844.patch","issue_url":"https://api.github.com/repos/nodejs/io.js/issues/1844","number":1844,"state":"open","locked":false,"title":"fs: set encoding on fs.createWriteStream","user":{"login":"yosuke-furukawa","id":555645,"avatar_url":"https://avatars.githubusercontent.com/u/555645?v=3","gravatar_id":"","url":"https://api.github.com/users/yosuke-furukawa","html_url":"https://github.com/yosuke-furukawa","followers_url":"https://api.github.com/users/yosuke-furukawa/followers","following_url":"https://api.github.com/users/yosuke-furukawa/following{/other_user}","gists_url":"https://api.github.com/users/yosuke-furukawa/gists{/gist_id}","starred_url":"https://api.github.com/users/yosuke-furukawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yosuke-furukawa/subscriptions","organizations_url":"https://api.github.com/users/yosuke-furukawa/orgs","repos_url":"https://api.github.com/users/yosuke-furukawa/repos","events_url":"https://api.github.com/users/yosuke-furukawa/events{/privacy}","received_events_url":"https://api.github.com/users/yosuke-furukawa/received_events","type":"User","site_admin":false},"body":"I just separated https://github.com/nodejs/io.js/pull/1412 .\r\nMuch time passed since I proposed the pull request. Sorry.\r\n\r\nI would like to introduce the pull request again.\r\n\r\nAccording to the [createWriteStream api docs](https://nodejs.org/api/fs.html#fs_fs_createwritestream_path_options), `encoding` option could be found.\r\n\r\n```js\r\n{ flags: 'w',\r\n  encoding: null,\r\n  fd: null,\r\n  mode: 0666 }\r\n```\r\n\r\nBut I set the encoding option to fs.createWriteStream('foo.txt', {encoding: 'utf8'}), the encoding option is ignored. I fixed the problem.\r\n\r\nAnd I added the `encoding` description in this doc. and I fixed test to avoid linter error.\r\n","created_at":"2015-05-30T19:10:59Z","updated_at":"2015-06-01T14:59:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a51b23fed88c84b5721a60b7e7c0555b9a9aa0a5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/io.js/pulls/1844/commits","review_comments_url":"https://api.github.com/repos/nodejs/io.js/pulls/1844/comments","review_comment_url":"https://api.github.com/repos/nodejs/io.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/io.js/issues/1844/comments","statuses_url":"https://api.github.com/repos/nodejs/io.js/statuses/608596c85a88f32fd2d16757a4663f1111032cf0","head":{"label":"yosuke-furukawa:fix/write/stream","ref":"fix/write/stream","sha":"608596c85a88f32fd2d16757a4663f1111032cf0","user":{"login":"yosuke-furukawa","id":555645,"avatar_url":"https://avatars.githubusercontent.com/u/555645?v=3","gravatar_id":"","url":"https://api.github.com/users/yosuke-furukawa","html_url":"https://github.com/yosuke-furukawa","followers_url":"https://api.github.com/users/yosuke-furukawa/followers","following_url":"https://api.github.com/users/yosuke-furukawa/following{/other_user}","gists_url":"https://api.github.com/users/yosuke-furukawa/gists{/gist_id}","starred_url":"https://api.github.com/users/yosuke-furukawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yosuke-furukawa/subscriptions","organizations_url":"https://api.github.com/users/yosuke-furukawa/orgs","repos_url":"https://api.github.com/users/yosuke-furukawa/repos","events_url":"https://api.github.com/users/yosuke-furukawa/events{/privacy}","received_events_url":"https://api.github.com/users/yosuke-furukawa/received_events","type":"User","site_admin":false},"repo":{"id":29194848,"name":"io.js","full_name":"yosuke-furukawa/io.js","owner":{"login":"yosuke-furukawa","id":555645,"avatar_url":"https://avatars.githubusercontent.com/u/555645?v=3","gravatar_id":"","url":"https://api.github.com/users/yosuke-furukawa","html_url":"https://github.com/yosuke-furukawa","followers_url":"https://api.github.com/users/yosuke-furukawa/followers","following_url":"https://api.github.com/users/yosuke-furukawa/following{/other_user}","gists_url":"https://api.github.com/users/yosuke-furukawa/gists{/gist_id}","starred_url":"https://api.github.com/users/yosuke-furukawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yosuke-furukawa/subscriptions","organizations_url":"https://api.github.com/users/yosuke-furukawa/orgs","repos_url":"https://api.github.com/users/yosuke-furukawa/repos","events_url":"https://api.github.com/users/yosuke-furukawa/events{/privacy}","received_events_url":"https://api.github.com/users/yosuke-furukawa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yosuke-furukawa/io.js","description":"A spork of Node.js with an open governance model","fork":true,"url":"https://api.github.com/repos/yosuke-furukawa/io.js","forks_url":"https://api.github.com/repos/yosuke-furukawa/io.js/forks","keys_url":"https://api.github.com/repos/yosuke-furukawa/io.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yosuke-furukawa/io.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yosuke-furukawa/io.js/teams","hooks_url":"https://api.github.com/repos/yosuke-furukawa/io.js/hooks","issue_events_url":"https://api.github.com/repos/yosuke-furukawa/io.js/issues/events{/number}","events_url":"https://api.github.com/repos/yosuke-furukawa/io.js/events","assignees_url":"https://api.github.com/repos/yosuke-furukawa/io.js/assignees{/user}","branches_url":"https://api.github.com/repos/yosuke-furukawa/io.js/branches{/branch}","tags_url":"https://api.github.com/repos/yosuke-furukawa/io.js/tags","blobs_url":"https://api.github.com/repos/yosuke-furukawa/io.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yosuke-furukawa/io.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yosuke-furukawa/io.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/yosuke-furukawa/io.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yosuke-furukawa/io.js/statuses/{sha}","languages_url":"https://api.github.com/repos/yosuke-furukawa/io.js/languages","stargazers_url":"https://api.github.com/repos/yosuke-furukawa/io.js/stargazers","contributors_url":"https://api.github.com/repos/yosuke-furukawa/io.js/contributors","subscribers_url":"https://api.github.com/repos/yosuke-furukawa/io.js/subscribers","subscription_url":"https://api.github.com/repos/yosuke-furukawa/io.js/subscription","commits_url":"https://api.github.com/repos/yosuke-furukawa/io.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/yosuke-furukawa/io.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/yosuke-furukawa/io.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/yosuke-furukawa/io.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/yosuke-furukawa/io.js/contents/{+path}","compare_url":"https://api.github.com/repos/yosuke-furukawa/io.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yosuke-furukawa/io.js/merges","archive_url":"https://api.github.com/repos/yosuke-furukawa/io.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yosuke-furukawa/io.js/downloads","issues_url":"https://api.github.com/repos/yosuke-furukawa/io.js/issues{/number}","pulls_url":"https://api.github.com/repos/yosuke-furukawa/io.js/pulls{/number}","milestones_url":"https://api.github.com/repos/yosuke-furukawa/io.js/milestones{/number}","notifications_url":"https://api.github.com/repos/yosuke-furukawa/io.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yosuke-furukawa/io.js/labels{/name}","releases_url":"https://api.github.com/repos/yosuke-furukawa/io.js/releases{/id}","created_at":"2015-01-13T14:58:31Z","updated_at":"2015-01-13T14:58:34Z","pushed_at":"2015-06-01T04:19:39Z","git_url":"git://github.com/yosuke-furukawa/io.js.git","ssh_url":"git@github.com:yosuke-furukawa/io.js.git","clone_url":"https://github.com/yosuke-furukawa/io.js.git","svn_url":"https://github.com/yosuke-furukawa/io.js","homepage":"","size":131202,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"v1.x"}},"base":{"label":"nodejs:master","ref":"master","sha":"4d6b768e5d8d04c76eb1d13bb3750dcc8d9935b2","user":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":27193779,"name":"io.js","full_name":"nodejs/io.js","owner":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodejs/io.js","description":"Node.js, but with bigger and faster version numbers","fork":false,"url":"https://api.github.com/repos/nodejs/io.js","forks_url":"https://api.github.com/repos/nodejs/io.js/forks","keys_url":"https://api.github.com/repos/nodejs/io.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/io.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/io.js/teams","hooks_url":"https://api.github.com/repos/nodejs/io.js/hooks","issue_events_url":"https://api.github.com/repos/nodejs/io.js/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/io.js/events","assignees_url":"https://api.github.com/repos/nodejs/io.js/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/io.js/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/io.js/tags","blobs_url":"https://api.github.com/repos/nodejs/io.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/io.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/io.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/io.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/io.js/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/io.js/languages","stargazers_url":"https://api.github.com/repos/nodejs/io.js/stargazers","contributors_url":"https://api.github.com/repos/nodejs/io.js/contributors","subscribers_url":"https://api.github.com/repos/nodejs/io.js/subscribers","subscription_url":"https://api.github.com/repos/nodejs/io.js/subscription","commits_url":"https://api.github.com/repos/nodejs/io.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/io.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/io.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/io.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/io.js/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/io.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/io.js/merges","archive_url":"https://api.github.com/repos/nodejs/io.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/io.js/downloads","issues_url":"https://api.github.com/repos/nodejs/io.js/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/io.js/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/io.js/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/io.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/io.js/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/io.js/releases{/id}","created_at":"2014-11-26T19:57:11Z","updated_at":"2015-06-01T14:31:43Z","pushed_at":"2015-06-01T14:18:05Z","git_url":"git://github.com/nodejs/io.js.git","ssh_url":"git@github.com:nodejs/io.js.git","clone_url":"https://github.com/nodejs/io.js.git","svn_url":"https://github.com/nodejs/io.js","homepage":"https://iojs.org","size":185285,"stargazers_count":12559,"watchers_count":12559,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":952,"mirror_url":null,"open_issues_count":293,"forks":952,"open_issues":293,"watchers":12559,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/1844"},"html":{"href":"https://github.com/nodejs/io.js/pull/1844"},"issue":{"href":"https://api.github.com/repos/nodejs/io.js/issues/1844"},"comments":{"href":"https://api.github.com/repos/nodejs/io.js/issues/1844/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/1844/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/1844/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/io.js/statuses/608596c85a88f32fd2d16757a4663f1111032cf0"}}}}