How to use the lchmodSync function from fs

Find comprehensive JavaScript fs.lchmodSync code examples handpicked from public code repositorys.

54
55
56
57
58
59
60
61
62
63
exports.ftruncate = co.promisify(fs.ftruncate);
exports.ftruncateSync = fs.ftruncateSync;
exports.futimes = co.promisify(fs.futimes);
exports.futimesSync = fs.futimesSync;
exports.lchmod = co.promisify(fs.lchmod);
exports.lchmodSync = fs.lchmodSync;
exports.lchown = co.promisify(fs.lchown);
exports.lchownSync = fs.lchownSync;
exports.link = co.promisify(fs.link);
exports.linkSync = fs.linkSync;
fork icon22
star icon45
watch icon26

127
128
129
130
131
132
133
134
135
136
137
138
139
  fs.lchmod(link, mode_async, common.mustCall((err) => {
    assert.ifError(err);


    assert.strictEqual(mode_async, fs.lstatSync(link).mode & 0o777);


    fs.lchmodSync(link, mode_sync);
    assert.strictEqual(mode_sync, fs.lstatSync(link).mode & 0o777);


  }));
}
fork icon16
star icon65
watch icon0

78
79
80
81
82
83
84
85
86
87
88
    const link = path.join(tmpdir.path, `lchmodSync-src-${suffix}`);
    const file = path.join(tmpdir.path, `lchmodSync-dest-${suffix}`);
    fs.writeFileSync(file, 'test', 'utf-8');
    fs.symlinkSync(file, link);


    fs.lchmodSync(link, input);
    assert.strictEqual(fs.lstatSync(link).mode & 0o777, mode);
  }
}

fork icon0
star icon0
watch icon0

+ 4 other calls in file

26
27
28
29
30
31
32
33
34
35
    code: 'ERR_INVALID_ARG_TYPE',
    name: 'TypeError'
  }
);
assert.throws(
  () => fs.lchmodSync(i),
  {
    code: 'ERR_INVALID_ARG_TYPE',
    name: 'TypeError'
  }
fork icon0
star icon0
watch icon0

+ 5 other calls in file

46
47
48
49
50
51
52
53
54
55
56
57
});


assert.throws(() => fs.lchmod(f, '123x', common.mustNotCall()), {
  code: 'ERR_INVALID_ARG_VALUE'
});
assert.throws(() => fs.lchmodSync(f, '123x'), {
  code: 'ERR_INVALID_ARG_VALUE'
});


[-1, 2 ** 32].forEach((input) => {
fork icon0
star icon0
watch icon0

+ 7 other calls in file