本文整理匯總了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");
};