| Server IP : 157.230.181.24 / Your IP : 216.73.217.11 Web Server : Apache/2.4.58 (Ubuntu) System : Linux conductive 6.8.0-117-generic #117-Ubuntu SMP PREEMPT_DYNAMIC Tue May 5 19:26:24 UTC 2026 x86_64 User : ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/vhosts/convo/node_modules/graceful-fs/test/ |
Upload File : |
var test = require('tap').test
var fs = require('../graceful-fs.js')
test('graceful fs is not fs', function (t) {
t.notEqual(fs, require('fs'))
t.end()
})
test('open an existing file works', function (t) {
var start = fs._curOpen
var fd = fs.openSync(__filename, 'r')
t.equal(fs._curOpen, start + 1)
fs.closeSync(fd)
t.equal(fs._curOpen, start)
fs.open(__filename, 'r', function (er, fd) {
if (er) throw er
t.equal(fs._curOpen, start + 1)
fs.close(fd, function (er) {
if (er) throw er
t.equal(fs._curOpen, start)
t.end()
})
})
})
test('open a non-existing file throws', function (t) {
var start = fs._curOpen
var er
try {
var fd = fs.openSync('this file does not exist', 'r')
} catch (x) {
er = x
}
t.ok(er, 'should throw')
t.notOk(fd, 'should not get an fd')
t.equal(er.code, 'ENOENT')
t.equal(fs._curOpen, start)
fs.open('neither does this file', 'r', function (er, fd) {
t.ok(er, 'should throw')
t.notOk(fd, 'should not get an fd')
t.equal(er.code, 'ENOENT')
t.equal(fs._curOpen, start)
t.end()
})
})