How to use the lchmod function from fs
Find comprehensive JavaScript fs.lchmod code examples handpicked from public code repositorys.
122 123 124 125 126 127 128 129 130 131 132 133 134if (fs.lchmod) { const link = path.join(common.tmpDir, 'symbolic-link'); fs.symlinkSync(file2, link); fs.lchmod(link, mode_async, common.mustCall((err) => { assert.ifError(err); assert.strictEqual(mode_async, fs.lstatSync(link).mode & 0o777);
67 68 69 70 71 72 73 74 75const link = path.join(tmpdir.path, `lchmod-src-${suffix}`); const file = path.join(tmpdir.path, `lchmod-dest-${suffix}`); fs.writeFileSync(file, 'test', 'utf-8'); fs.symlinkSync(file, link); fs.lchmod(link, input, common.mustSucceed(() => { assert.strictEqual(fs.lstatSync(link).mode & 0o777, mode); })); }
+ 4 other calls in file
GitHub: EzSylester/Node
133 134 135 136 137 138 139 140 141 142try { fs.unlinkSync(link); } catch (er) {} fs.symlinkSync(file2, link); fs.lchmod(link, mode_async, function(err) { if (err) { got_error = true; } else { console.log(fs.lstatSync(link).mode);
127 128 129 130 131 132 133 134 135 136 137 138 139if (fs.lchmod) { const link = path.join(tmpdir.path, 'symbolic-link'); fs.symlinkSync(file2, link); fs.lchmod(link, mode_async, common.mustSucceed(() => { assert.strictEqual(fs.lstatSync(link).mode & 0o777, mode_async); fs.lchmodSync(link, mode_sync); assert.strictEqual(fs.lstatSync(link).mode & 0o777, mode_sync);
+ 4 other calls in file
19 20 21 22 23 24 25 26 27 28 29assert.throws(() => fs.lchmod(f, {}), { code: 'ERR_INVALID_CALLBACK' }); // Check path [false, 1, {}, [], null, undefined].forEach((i) => { assert.throws( () => fs.lchmod(i, 0o777, common.mustNotCall()), { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' }
+ 7 other calls in file
12 13 14 15 16 17 18 19 20 21 22 23common.skip('lchmod is only available on macOS'); } // Check callback assert.throws(() => fs.lchmod(f), { code: 'ERR_INVALID_ARG_TYPE' }); assert.throws(() => fs.lchmod(), { code: 'ERR_INVALID_ARG_TYPE' }); assert.throws(() => fs.lchmod(f, {}), { code: 'ERR_INVALID_ARG_TYPE' }); // Check path [false, 1, {}, [], null, undefined].forEach((i) => {
+ 9 other calls in file
fs.readFileSync is the most popular function in fs (2736 examples)