node: fix signatures of readFile*

This commit is contained in:
Paul Loyd
2014-03-17 14:55:17 +04:00
parent e2031426d0
commit e3b9fef277
2 changed files with 21 additions and 4 deletions
+16 -2
View File
@@ -21,7 +21,9 @@ assert.doesNotThrow(() => {
if (false) { throw "a hammer at your face"; }
}, undefined, "What the...*crunch*");
////////////////////////////////////////////////////
/// File system tests : http://nodejs.org/api/fs.html
////////////////////////////////////////////////////
fs.writeFile("thebible.txt",
"Do unto others as you would have them do unto you.",
assert.ifError);
@@ -33,6 +35,18 @@ fs.writeFile("Harry Potter",
},
assert.ifError);
var content: string,
buffer: NodeBuffer;
content = fs.readFileSync('testfile', 'utf8');
content = fs.readFileSync('testfile', {encoding : 'utf8'});
buffer = fs.readFileSync('testfile');
buffer = fs.readFileSync('testfile', {flag : 'r'});
fs.readFile('testfile', 'utf8', (err, data) => content = data);
fs.readFile('testfile', {encoding : 'utf8'}, (err, data) => content = data);
fs.readFile('testfile', (err, data) => buffer = data);
fs.readFile('testfile', {flag : 'r'}, (err, data) => buffer = data);
class Networker extends events.EventEmitter {
constructor() {
super();
@@ -65,4 +79,4 @@ function stream_readable_pipe_test() {
var z = zlib.createGzip();
var w = fs.createWriteStream('file.txt.gz');
r.pipe(z).pipe(w);
}
}