本文整理汇总了TypeScript中fs-extra.chmodSync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript chmodSync函数的具体用法?TypeScript chmodSync怎么用?TypeScript chmodSync使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了chmodSync函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: writeFileWorker
export function writeFileWorker(data: any, callback: any) {
fs.ensureDirSync(path.dirname(data.file));
if (fs.existsSync(data.file)) {
// remove read-only and other attributes and delete file
fs.chmodSync(data.file, '0777');
fs.unlinkSync(data.file);
}
const content = Buffer.from(data.content);
fs.writeFileSync(data.file, content);
callback();
}
示例2: createNpmBinScript
export function createNpmBinScript(execName: string): void {
let fileName: string;
let script: string;
if (process.platform === 'win32') {
fileName = `${execName}.cmd`;
script = `.\\.ruff\\bin\\${execName}.exe %*`;
} else {
fileName = execName;
script = `\
#!/bin/sh
./.ruff/bin/${execName} "$@"`;
}
let filePath = Path.resolve('node_modules/.bin', fileName);
FS.outputFileSync(filePath, script);
if (process.platform !== 'win32') {
FS.chmodSync(filePath, 0o744);
}
}
示例3:
fs.pathExists(path).then((_exist: boolean) => {
// stub
});
fs.pathExists(path, (_err: Error, _exists: boolean) => { });
const x: boolean = fs.pathExistsSync(path);
fs.rename(src, dest, errorCallback);
fs.renameSync(src, dest);
fs.truncate(path, len, errorCallback);
fs.truncateSync(path, len);
fs.chown(path, uid, gid, errorCallback);
fs.chownSync(path, uid, gid);
fs.fchown(fd, uid, gid, errorCallback);
fs.fchownSync(fd, uid, gid);
fs.lchown(path, uid, gid, errorCallback);
fs.lchownSync(path, uid, gid);
fs.chmod(path, modeNum, errorCallback);
fs.chmod(path, modeStr, errorCallback);
fs.chmodSync(path, modeNum);
fs.chmodSync(path, modeStr);
fs.fchmod(fd, modeNum, errorCallback);
fs.fchmod(fd, modeStr, errorCallback);
fs.fchmodSync(fd, modeNum);
fs.fchmodSync(fd, modeStr);
fs.lchmod(path, modeStr, errorCallback);
fs.lchmod(path, modeNum, errorCallback);
fs.lchmodSync(path, modeNum);
fs.lchmodSync(path, modeStr);
fs.statSync(path);
fs.lstatSync(path);
示例4: initLogs
static initLogs(basePath: string, gelf) {
let logPath: string = basePath;
try{
fs.ensureDirSync(logPath);
fs.chmodSync(logPath, '777');
debug(`${logPath} is used to store log Files`);
} catch(e) {
debug(`CANNOT create log ${logPath}`);
logPath = path.join(__dirname, basePath);
try {
fs.ensureDirSync(logPath);
fs.chmodSync(logPath, '777');
debug(`${logPath} is used to store log Files`);
} catch(e) {
debug(e);
debug(`CANNOT create log ${logPath}`);
throw new Error(e);
}
}
const appStreams: bunyan.Stream[] = [
{
level: 'trace',
path: path.join(logPath, 'trace.log')
},
{
level: 'info',
path: path.join(logPath, 'info.log')
},
{
level: 'error',
path: path.join(logPath, 'error.log')
}
];
const webAppStreams: bunyan.Stream[] = [
{
level: 'trace',
path: path.join(logPath, 'web-app.log')
},
{
level: 'error',
path: path.join(logPath, 'web-app-error.log')
}
];
if(gelf.enabled) {
const stream = gelfStream.forBunyan(gelf.host, gelf.port);
appStreams.push({
stream: stream,
type: 'raw',
level: 'trace'
});
webAppStreams.push({
stream: stream,
type: 'raw',
level: 'trace'
});
}
ServerLog.Log = bunyan.createLogger(
{
name: 'ServerLog',
streams: appStreams,
serializers: bunyan.stdSerializers
}
);
ServerLog.Log.addSerializers({
pool: ServerLog.poolSerializer
});
ServerLog.WebAppLog = bunyan.createLogger({
name: "WebApp",
streams: webAppStreams,
serializers: bunyan.stdSerializers
});
ServerLog.WebAppLog.addSerializers({
pool: ServerLog.poolSerializer
});
}
示例5:
.then(() => {
fs.copySync(tmpfile, emulator.localPath);
fs.chmodSync(emulator.localPath, 0o755);
})
示例6:
const preparations = () => {
fse.outputFileSync("a/b/c.txt", "abc");
fse.chmodSync("a/b", "700");
fse.chmodSync("a/b/c.txt", "711");
};