Fixed README issues, and fixed misuse of expect() syntax.

This commit is contained in:
kwkofler 2014-03-08 13:53:53 -05:00
parent c975c2e3e6
commit 4ff7c7d7cb
4 changed files with 816 additions and 149 deletions

View File

@ -331,7 +331,7 @@ fs.open('/myfile', 'w', function(err, fd) {
#### fs.stat(path, callback)<a name="stat"></a> #### fs.stat(path, callback)<a name="stat"></a>
Obtain file status about the file at `path`. Asynchronous [stat(2)](http://pubs.opengroup.org/onlinepubs/009695399/functions/stat.html). Obtain file status about the file at `path`. Asynchronous [stat(2)](http://pubs.opengroup.org/onlinepubs/009695399/functions/stat.html).
Callback gets `(error, stats)`, where `stats` is an object with the following properties... Callback gets `(error, stats)`, where `stats` is an object with the following properties:
``` ```
{ {
@ -346,15 +346,15 @@ Callback gets `(error, stats)`, where `stats` is an object with the following pr
} }
``` ```
...and the following methods: The following convenience methods are also present on the callback's 'stats':
isFile(): Returns true if the node is a file. isFile(): Returns true if the node is a file.
isDirectory(): Returns true if the node is a directory. isDirectory(): Returns true if the node is a directory.
isBlockDevice(): Not implemented, returns false. isBlockDevice(): Not implemented, returns false.
isCharacterDevice(): Not implemented, returns false. isCharacterDevice(): Not implemented, returns false.
isSymbolicLink(): Returns true if the node is a symbolic link. isSymbolicLink(): Returns true if the node is a symbolic link.
isFIFO(): Not implemented, returns false. isFIFO(): Not implemented, returns false.
isSocket(): Not implemented, returns false. isSocket(): Not implemented, returns false.
If the file at `path` is a symbolic link, the file to which it links will be used instead. If the file at `path` is a symbolic link, the file to which it links will be used instead.
To get the status of a symbolic link file, use [fs.lstat()](#lstat) instead. To get the status of a symbolic link file, use [fs.lstat()](#lstat) instead.

892
dist/filer.js vendored

File diff suppressed because it is too large Load Diff

5
dist/filer.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ define(["Filer", "util"], function(Filer, util) {
var fs = util.fs(); var fs = util.fs();
fs.stat('/', function(error, stats) { fs.stat('/', function(error, stats) {
if(error) throw error; if(error) throw error;
expect(typeof stats.isFile).to.equal('function'); expect(stats.isFile).to.be.a('function');
}); });
}); });
@ -19,7 +19,7 @@ define(["Filer", "util"], function(Filer, util) {
fs.open('/myfile', 'w+', function(error, fd) { fs.open('/myfile', 'w+', function(error, fd) {
if(error) throw error; if(error) throw error;
fs.fstat(fd, function(error, stats) { fs.fstat(fd, function(error, stats) {
expect(stats.isFile()).to.equal(true); expect(stats.isFile()).to.be.true;
done(); done();
}); });
}); });
@ -30,7 +30,7 @@ define(["Filer", "util"], function(Filer, util) {
fs.stat('/', function(error, stats) { fs.stat('/', function(error, stats) {
if(error) throw error; if(error) throw error;
expect(stats.isFile()).to.equal(false); expect(stats.isFile()).to.be.false;
done(); done();
}); });
}); });
@ -45,7 +45,7 @@ define(["Filer", "util"], function(Filer, util) {
fs.symlink('/myfile', '/myfilelink', function(error) { fs.symlink('/myfile', '/myfilelink', function(error) {
if(error) throw error; if(error) throw error;
fs.lstat('/myfilelink', function(error, stats) { fs.lstat('/myfilelink', function(error, stats) {
expect(stats.isFile()).to.equal(false); expect(stats.isFile()).to.be.false;
done(); done();
}); });
}); });
@ -62,7 +62,7 @@ define(["Filer", "util"], function(Filer, util) {
var fs = util.fs(); var fs = util.fs();
fs.stat('/', function(error, stats) { fs.stat('/', function(error, stats) {
if(error) throw error; if(error) throw error;
expect(typeof stats.isDirectory).to.equal('function'); expect(stats.isDirectory).to.be.a('function');
}); });
}); });
@ -72,7 +72,7 @@ define(["Filer", "util"], function(Filer, util) {
fs.open('/myfile', 'w+', function(error, fd) { fs.open('/myfile', 'w+', function(error, fd) {
if(error) throw error; if(error) throw error;
fs.fstat(fd, function(error, stats) { fs.fstat(fd, function(error, stats) {
expect(stats.isDirectory()).to.equal(false); expect(stats.isDirectory()).to.be.false;
done(); done();
}); });
}); });
@ -83,7 +83,7 @@ define(["Filer", "util"], function(Filer, util) {
fs.stat('/', function(error, stats) { fs.stat('/', function(error, stats) {
if(error) throw error; if(error) throw error;
expect(stats.isDirectory()).to.equal(true); expect(stats.isDirectory()).to.be.true;
done(); done();
}); });
}); });
@ -98,7 +98,7 @@ define(["Filer", "util"], function(Filer, util) {
fs.symlink('/myfile', '/myfilelink', function(error) { fs.symlink('/myfile', '/myfilelink', function(error) {
if(error) throw error; if(error) throw error;
fs.lstat('/myfilelink', function(error, stats) { fs.lstat('/myfilelink', function(error, stats) {
expect(stats.isDirectory()).to.equal(false); expect(stats.isDirectory()).to.be.false;
done(); done();
}); });
}); });
@ -115,7 +115,7 @@ define(["Filer", "util"], function(Filer, util) {
var fs = util.fs(); var fs = util.fs();
fs.stat('/', function(error, stats) { fs.stat('/', function(error, stats) {
if(error) throw error; if(error) throw error;
expect(typeof stats.isBlockDevice).to.equal('function'); expect(stats.isBlockDevice).to.be.a('function');
}); });
}); });
@ -123,7 +123,7 @@ define(["Filer", "util"], function(Filer, util) {
var fs = util.fs(); var fs = util.fs();
fs.stat('/', function(error, stats) { fs.stat('/', function(error, stats) {
if(error) throw error; if(error) throw error;
expect(stats.isBlockDevice()).to.equal(false); expect(stats.isBlockDevice()).to.be.false;
}); });
}); });
}); });
@ -136,7 +136,7 @@ define(["Filer", "util"], function(Filer, util) {
var fs = util.fs(); var fs = util.fs();
fs.stat('/', function(error, stats) { fs.stat('/', function(error, stats) {
if(error) throw error; if(error) throw error;
expect(typeof stats.isCharacterDevice).to.equal('function'); expect(stats.isCharacterDevice).to.be.a('function');
}); });
}); });
@ -144,7 +144,7 @@ define(["Filer", "util"], function(Filer, util) {
var fs = util.fs(); var fs = util.fs();
fs.stat('/', function(error, stats) { fs.stat('/', function(error, stats) {
if(error) throw error; if(error) throw error;
expect(stats.isCharacterDevice()).to.equal(false); expect(stats.isCharacterDevice()).to.be.false;
}); });
}); });
}); });
@ -157,7 +157,7 @@ define(["Filer", "util"], function(Filer, util) {
var fs = util.fs(); var fs = util.fs();
fs.stat('/', function(error, stats) { fs.stat('/', function(error, stats) {
if(error) throw error; if(error) throw error;
expect(typeof stats.isSymbolicLink).to.equal('function'); expect(stats.isSymbolicLink).to.be.a('function');
}); });
}); });
@ -167,7 +167,7 @@ define(["Filer", "util"], function(Filer, util) {
fs.open('/myfile', 'w+', function(error, fd) { fs.open('/myfile', 'w+', function(error, fd) {
if(error) throw error; if(error) throw error;
fs.fstat(fd, function(error, stats) { fs.fstat(fd, function(error, stats) {
expect(stats.isSymbolicLink()).to.equal(false); expect(stats.isSymbolicLink()).to.be.false;
done(); done();
}); });
}); });
@ -178,7 +178,7 @@ define(["Filer", "util"], function(Filer, util) {
fs.stat('/', function(error, stats) { fs.stat('/', function(error, stats) {
if(error) throw error; if(error) throw error;
expect(stats.isSymbolicLink()).to.equal(false); expect(stats.isSymbolicLink()).to.be.false;
done(); done();
}); });
}); });
@ -193,7 +193,7 @@ define(["Filer", "util"], function(Filer, util) {
fs.symlink('/myfile', '/myfilelink', function(error) { fs.symlink('/myfile', '/myfilelink', function(error) {
if(error) throw error; if(error) throw error;
fs.lstat('/myfilelink', function(error, stats) { fs.lstat('/myfilelink', function(error, stats) {
expect(stats.isSymbolicLink()).to.equal(true); expect(stats.isSymbolicLink()).to.be.true;
done(); done();
}); });
}); });
@ -210,7 +210,7 @@ define(["Filer", "util"], function(Filer, util) {
var fs = util.fs(); var fs = util.fs();
fs.stat('/', function(error, stats) { fs.stat('/', function(error, stats) {
if(error) throw error; if(error) throw error;
expect(typeof stats.isFIFO).to.equal('function'); expect(stats.isFIFO).to.be.a('function');
}); });
}); });
@ -218,7 +218,7 @@ define(["Filer", "util"], function(Filer, util) {
var fs = util.fs(); var fs = util.fs();
fs.stat('/', function(error, stats) { fs.stat('/', function(error, stats) {
if(error) throw error; if(error) throw error;
expect(stats.isFIFO()).to.equal(false); expect(stats.isFIFO()).to.be.false;
}); });
}); });
}); });
@ -231,7 +231,7 @@ define(["Filer", "util"], function(Filer, util) {
var fs = util.fs(); var fs = util.fs();
fs.stat('/', function(error, stats) { fs.stat('/', function(error, stats) {
if(error) throw error; if(error) throw error;
expect(typeof stats.isSocket).to.equal('function'); expect(stats.isSocket).to.be.a('function');
}); });
}); });
@ -239,7 +239,7 @@ define(["Filer", "util"], function(Filer, util) {
var fs = util.fs(); var fs = util.fs();
fs.stat('/', function(error, stats) { fs.stat('/', function(error, stats) {
if(error) throw error; if(error) throw error;
expect(stats.isSocket()).to.equal(false); expect(stats.isSocket()).to.be.false;
}); });
}); });
}); });