How to use the chownSync function from fs
Find comprehensive JavaScript fs.chownSync code examples handpicked from public code repositorys.
GitHub: blockcollider/bcnode
13 14 15 16 17 18 19 20 21 22
exports.appendFile = co.promisify(fs.appendFile); exports.appendFileSync = fs.appendFileSync; exports.chmod = co.promisify(fs.chmod); exports.chmodSync = fs.chmodSync; exports.chown = co.promisify(fs.chown); exports.chownSync = fs.chownSync; exports.close = co.promisify(fs.close); exports.closeSync = fs.closeSync; exports.constants = fs.constants; exports.createReadStream = fs.createReadStream;
22
45
26
604 605 606 607 608 609 610 611 612 613 614 615
fs.chown(nonexistentFile, process.getuid(), process.getgid(), common.mustCall(validateError)); assert.throws( () => fs.chownSync(nonexistentFile, process.getuid(), process.getgid()), validateError ); }
42
19
0
776 777 778 779 780 781 782 783 784 785
try { fs.fchownSync(fd, uid, gid) } catch (fchowner) { try { fs.chownSync(entry.absolute, uid, gid) } catch (chowner) { er = er || fchowner } }
3
2
0
107 108 109 110 111 112 113 114 115 116 117
// fs.chownSync (should not bypass) { assert.throws(() => { // This operation will work fine fs.chownSync(blockedFile, uid, gid); fs.readFileSync(blockedFile); }, common.expectsError({ code: 'ERR_ACCESS_DENIED', permission: 'FileSystemRead',
0
0
0
21 22 23 24 25 26 27 28 29 30 31
} /* istanbul ignore next */ const chownSync = (path, uid, gid) => { try { return fs.chownSync(path, uid, gid) } catch (er) { if (er.code !== 'ENOENT') throw er }
0
0
0
34 35 36 37 38 39 40 41 42 43
code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' } ); assert.throws( () => fs.chownSync('not_a_file_that_exists', i, 1), { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' }
0
0
0
+ 5 other calls in file
87 88 89 90 91 92 93 94 95
CACHE_DIR = path.resolve(common.cache, '' + cacheIteration++) npm.config.set('cache', CACHE_DIR) mkdirp.sync(CACHE_DIR) if (isRoot && sudoUID && sudoGID) { chownSync(CACHE_DIR, sudoUID, sudoGID) } installAskedFor = undefined
0
0
0
fs.readFileSync is the most popular function in fs (2736 examples)