fs: check argument type on createStream method
separeted https://github.com/nodejs/io.js/pull/1412
On Node.js v0.12
// illegal option but does not throw an Error, just ignore.
fs.createReadStream('foo.txt', 'utf8');
// illegal option but does not throw an Error, just ignore.
fs.createWriteStream('hoge', 'utf8');
On io.js v1.6.4
// illegal option and throw an Error
fs.createReadStream('foo.txt', 'utf8');
fs.js:1619
options = Object.create(options || {});
^
TypeError: Object prototype may only be an Object or null: utf8
at Function.create (native)
at new ReadStream (fs.js:1619:20)
at Object.fs.createReadStream (fs.js:1608:10)
at Object.<anonymous> (/Users/yosuke/go/src/github.com/yosuke-furukawa/fork/io.js/test/parallel/test-fs-write-stream-encoding.js:12:30)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:428:10)
at Module.load (module.js:335:32)
at Function.Module._load (module.js:290:12)
at Function.Module.runMain (module.js:451:10)
at startup (node.js:124:18)
// illegal option but does not throw an Error, just ignore.
fs.createWriteStream('hoge', 'utf8');
I added document and fixed test to avoid linter errors.