Update docs, fix test failure

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2018-12-01 23:59:36 -05:00 committed by David Humphrey
parent 6a5d9073f3
commit 7d196763f8
2 changed files with 18 additions and 3 deletions

View File

@ -914,7 +914,22 @@ fs.open('/myfile.txt', function(err, fd) {
#### fs.fsync(fd, callback)<a name="fsync"></a>
NOTE: Not yet implemented, see https://github.com/filerjs/filer/issues/87
Synchronize the data and metadata for the file referred to by `fd` to disk.
Asynchronous [fsync(2)](http://man7.org/linux/man-pages/man2/fsync.2.html).
The callback gets `(error)`.
```js
fs.open('/myfile', 'r', function(error, fd) {
if(err) throw err;
// Use fd, then sync
fs.fsync(fd, function(error) {
if(err) throw err;
fs.close(fd, done);
});
});
```
#### fs.write(fd, buffer, offset, length, position, callback)<a name="write"></a>

View File

@ -38,8 +38,8 @@ describe('fs.fsync', function() {
if(error) throw error;
fs.fsync(fd, function(error) {
expect(error).to.not.exist;
fs.close(done);
expect(error).not.to.exist;
fs.close(fd, done);
});
});
});