當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript fs-extra.chmodSync函數代碼示例

本文整理匯總了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();
}
開發者ID:igor-bezkrovny,項目名稱:texturer,代碼行數:14,代碼來源:writeFileWorker.ts

示例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);
    }
}
開發者ID:vilic,項目名稱:rvm,代碼行數:21,代碼來源:index.ts

示例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);
開發者ID:gilamran,項目名稱:DefinitelyTyped,代碼行數:30,代碼來源:fs-extra-tests.ts

示例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
        });
    }
開發者ID:a-lucas,項目名稱:angular.js-server,代碼行數:88,代碼來源:serverLog.ts

示例5:

 .then(() => {
   fs.copySync(tmpfile, emulator.localPath);
   fs.chmodSync(emulator.localPath, 0o755);
 })
開發者ID:firebase,項目名稱:firebase-tools,代碼行數:4,代碼來源:download.ts

示例6:

 const preparations = () => {
   fse.outputFileSync("a/b/c.txt", "abc");
   fse.chmodSync("a/b", "700");
   fse.chmodSync("a/b/c.txt", "711");
 };
開發者ID:szwacz,項目名稱:fs-jetpack,代碼行數:5,代碼來源:copy.spec.ts


注:本文中的fs-extra.chmodSync函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。