• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript fs-extra.chmodSync函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript fs-extra.closeSync函数代码示例发布时间:2022-05-25
下一篇:
TypeScript fs-extra.appendFile函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap