mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
node: fix signatures of readFile*
This commit is contained in:
+16
-2
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user