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

TypeScript fs.chmodSync函数代码示例

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

本文整理汇总了TypeScript中fs.chmodSync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript chmodSync函数的具体用法?TypeScript chmodSync怎么用?TypeScript chmodSync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了chmodSync函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: rej

      .once('close', (e: Error) => {
        if (e) {
          rej(e)
        } else if (compiler.output) {
          const output = compiler.output,
            mode = statSync(output).mode | 0o111,
            inputFileLogOutput = relative(
              process.cwd(),
              resolve(compiler.options.cwd, compiler.entrypoint || compiler.options.input)
            ),
            outputFileLogOutput = relative(process.cwd(), output)

          chmodSync(output, mode.toString(8).slice(-3))
          step.log(
            `Entry: '${
              compiler.stdinUsed
                ? compiler.options.mangle
                  ? STDIN_FLAG
                  : '[none]'
                : inputFileLogOutput
            }' written to: ${outputFileLogOutput}`
          )
          compiler.quit()
          res(output)
        }
      })
开发者ID:jaredallard,项目名称:nexe,代码行数:26,代码来源:cli.ts


示例2: register

register("package", async (runner, releaseTag) => {
	if (!releaseTag) {
		throw new Error("Please specify the release tag.");
	}

	const releasePath = path.resolve(__dirname, "../release");

	const archiveName = `code-server-${releaseTag}-${os.platform()}-${os.arch()}`;
	const archiveDir = path.join(releasePath, archiveName);
	fse.removeSync(archiveDir);
	fse.mkdirpSync(archiveDir);

	const binaryPath = path.join(__dirname, `../packages/server/cli-${os.platform()}-${os.arch()}`);
	const binaryDestination = path.join(archiveDir, "code-server");
	fse.copySync(binaryPath, binaryDestination);
	fs.chmodSync(binaryDestination, "755");
	["README.md", "LICENSE"].forEach((fileName) => {
		fse.copySync(path.resolve(__dirname, `../${fileName}`), path.join(archiveDir, fileName));
	});

	runner.cwd = releasePath;
	await os.platform() === "linux"
		? runner.execute("tar", ["-cvzf", `${archiveName}.tar.gz`, `${archiveName}`])
		: runner.execute("zip", ["-r", `${archiveName}.zip`, `${archiveName}`]);
});
开发者ID:AhmadAlyTanany,项目名称:code-server,代码行数:25,代码来源:tasks.ts


示例3: generateToolsJs

async function generateToolsJs(): Promise<void> {
  for (const bin of ["configure-ui", "dump-data-model"]) {
    const inputFile = path.resolve(INPUT_DIR, `tools/${bin}`);
    const outputFile = path.resolve(OUTPUT_DIR, `tools/${bin}`);
    const bundle = await rollup({
      input: inputFile,
      external: externals,
      acorn: {
        allowHashBang: true
      },
      plugins: [
        rollupReplace({
          delimiters: ["", ""],
          "#!/usr/bin/env -S node -r esm -r ts-node/register/transpile-only": ""
        }),
        typescript({
          tsconfig: "./tsconfig.json",
          include: [`tools/${bin}`, "lib/**/*.ts"]
        }),
        MODE === "production" ? terser() : null
      ]
    });

    await bundle.write({
      format: "cjs",
      preferConst: true,
      banner: "#!/usr/bin/env node",
      file: outputFile
    });

    // Mark as executable
    const mode = fs.statSync(outputFile).mode;
    fs.chmodSync(outputFile, mode | 73);
  }
}
开发者ID:zaidka,项目名称:genieacs,代码行数:35,代码来源:build.ts


示例4: getTidyExec

 /**
 * filename of the tidy html 5 executable
 *
 * @returns filepname
 */
 private getTidyExec() {
     if (!this.tidyExec) {
         let tidyExecPath = this.config.tidyExecPath;
         if (tidyExecPath && !this.isExecutable(tidyExecPath)) {
             tidyExecPath = null;
             vscode.window.showWarningMessage(`Configured tidy executable is not usable (tidyHtml.tidyExecPath=${tidyExecPath}). Using default tidy executable instead.`);
         }
         if (!tidyExecPath) {
             tidyExecPath = this.getDefaultTidyExec();
             if (!this.isExecutable(tidyExecPath)) {
                 if (process.platform !== 'win32') {
                     fs.chmodSync(tidyExecPath, 0o755);
                     if (!this.isExecutable(tidyExecPath)) {
                         tidyExecPath = null;
                         vscode.window.showWarningMessage(`Default tidy executable (${tidyExecPath}) is missing execute permission. Please configure tidyHtml.tidyExecPath or fix permissions.`);
                     }
                 } else {
                     tidyExecPath = null;
                 }
             }
         }
         this.tidyExec = tidyExecPath;
     }
     return this.tidyExec;
 }
开发者ID:AnWeber,项目名称:vscode-tidyhtml,代码行数:30,代码来源:tidyformatter.ts


示例5: getKubectl

    private async getKubectl() : Promise<string> {
        let versionOrLocation = tl.getInput("versionOrLocation");
        if( versionOrLocation === "location") {
            let pathToKubectl = tl.getPathInput("specifyLocation", true, true);
            fs.chmodSync(pathToKubectl, "777");
            return pathToKubectl;
        }
        else if(versionOrLocation === "version") {
            var defaultVersionSpec = "1.7.0";
            let versionSpec = tl.getInput("versionSpec");
            let checkLatest: boolean = tl.getBoolInput('checkLatest', false);
            var version = await utils.getKubectlVersion(versionSpec, checkLatest);
            if (versionSpec != defaultVersionSpec || checkLatest)
            {
               tl.debug(tl.loc("DownloadingClient"));
               var version = await utils.getKubectlVersion(versionSpec, checkLatest);
               return await utils.downloadKubectl(version); 
            }

            // Reached here => default version
            // Now to handle back-compat, return the version installed on the machine
            if(this.kubectlPath && fs.existsSync(this.kubectlPath))
            {
                return this.kubectlPath;
            }
            
           // Download the default version
           tl.debug(tl.loc("DownloadingClient"));
           var version = await utils.getKubectlVersion(versionSpec, checkLatest);
           return await utils.downloadKubectl(version); 
        }
    }
开发者ID:grawcho,项目名称:vso-agent-tasks,代码行数:32,代码来源:clusterconnection.ts


示例6: it

   it('should report IO errors', done => {
      const inputPath = path.join(__dirname, './fixtures/test.coffee');
      const inputBase = path.join(__dirname, './fixtures/');
      const expectedPath = path.join(__dirname, './out-fixtures/test.coffee');
      const expectedContents = fs.readFileSync(inputPath);
      const expectedCwd = __dirname;
      const expectedBase = path.join(__dirname, './out-fixtures');
      const expectedMode = parseInt("0722", 8);

      const expectedFile = new File({
         base: inputBase,
         cwd: __dirname,
         path: inputPath,
         contents: expectedContents,
         stat: {
            mode: expectedMode
         } as fs.Stats
      });

      fs.mkdirSync(expectedBase);
      fs.chmodSync(expectedBase, 0);

      const stream = vfs.symlink('./out-fixtures/', { cwd: __dirname });
      stream.on('error', (err: any) => {
         err.code.should.equal('EACCES');
         done();
      });
      stream.write(expectedFile);
   });
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:29,代码来源:vinyl-fs-tests.ts


示例7: generateBackendJs

async function generateBackendJs(): Promise<void> {
  for (const bin of [
    "genieacs-cwmp",
    "genieacs-ext",
    "genieacs-nbi",
    "genieacs-fs",
    "genieacs-ui"
  ]) {
    const inputFile = path.resolve(INPUT_DIR, `bin/${bin}`);
    const outputFile = path.resolve(OUTPUT_DIR, `bin/${bin}`);
    const bundle = await rollup({
      input: inputFile,
      external: externals,
      acorn: {
        allowHashBang: true
      },
      treeshake: {
        propertyReadSideEffects: false,
        pureExternalModules: true
      },
      plugins: [
        rollupReplace({
          delimiters: ["", ""],
          "#!/usr/bin/env -S node -r esm -r ts-node/register/transpile-only": ""
        }),
        rollupJson({ preferConst: true }),
        {
          resolveId: (importee, importer) => {
            if (importee.endsWith("/package.json")) {
              const p = path.resolve(path.dirname(importer), importee);
              if (p === path.resolve(INPUT_DIR, "package.json"))
                return path.resolve(OUTPUT_DIR, "package.json");
            }
            return null;
          }
        },
        typescript({
          tsconfig: "./tsconfig.json",
          include: [`bin/${bin}`, "lib/**/*.ts"]
        }),
        MODE === "production" ? terser() : null
      ]
    });

    await bundle.write({
      format: "cjs",
      preferConst: true,
      banner: "#!/usr/bin/env node",
      file: outputFile
    });

    // Mark as executable
    const mode = fs.statSync(outputFile).mode;
    fs.chmodSync(outputFile, mode | 73);
  }
}
开发者ID:zaidka,项目名称:genieacs,代码行数:56,代码来源:build.ts


示例8: start

	static start( wrapperId: string, pidPath: string, packagePath: string, executablePath: string, args: string[], options?: cp.SpawnOptions )
	{
		let wrapperExecutable = this.getWrapperExecutable();

		// Ensure that the wrapper executable is.. executable.
		fs.chmodSync( wrapperExecutable, '0755' );

		let child = cp.spawn( wrapperExecutable, [ wrapperId, pidPath, packagePath, executablePath ].concat( args ), options );
		child.unref();
	}
开发者ID:gamejolt,项目名称:client-game-wrapper,代码行数:10,代码来源:index.ts


示例9: catch

function unzip<T extends Binary>(binary: T, outputDir: string, fileName: string): void {
  // remove the previously saved file and unzip it
  let osType = Config.osType();
  let mv = path.resolve(outputDir, binary.executableFilename(osType));
  try {
    fs.unlinkSync(mv);
  } catch (err) {
    try {
      rimraf.sync(mv);
    } catch (err2) {
    }
  }

  // unzip the file
  logger.info(binary.name + ': unzipping ' + fileName);
  if (fileName.slice(-4) == '.zip') {
    let zip = new AdmZip(path.resolve(outputDir, fileName));
    zip.extractAllTo(outputDir, true);
  } else {
    // We will only ever get .tar files on linux
    child_process.spawnSync('tar', ['zxvf', path.resolve(outputDir, fileName), '-C', outputDir]);
  }

  // rename
  fs.renameSync(path.resolve(outputDir, binary.zipContentName(osType)), mv);

  // set permissions
  if (osType !== 'Windows_NT') {
    logger.info(binary.name + ': setting permissions to 0755 for ' + mv);
    if (binary.id() !== AndroidSDK.id) {
      fs.chmodSync(mv, '0755');
    } else {
      fs.chmodSync(path.resolve(mv, 'tools', 'android'), '0755');
      fs.chmodSync(path.resolve(mv, 'tools', 'emulator'), '0755');
      // TODO(sjelin): get 64 bit versions working
    }
  }
}
开发者ID:sjelin,项目名称:webdriver-manager,代码行数:38,代码来源:update.ts


示例10: mkShim

function mkShim(shell: string, shimPath: string): boolean {
	const template = getTemplate(shell);
	let result = false;

	try {
		fs.writeFileSync(shimPath, template);
		fs.chmodSync(shimPath, 0o744);
		result = true;
	} catch (e) {
		console.log(e);
	}

	return result;
}
开发者ID:rubyide,项目名称:vscode-ruby,代码行数:14,代码来源:env.ts



注:本文中的fs.chmodSync函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript fs.close函数代码示例发布时间:2022-05-25
下一篇:
TypeScript fs.chmod函数代码示例发布时间: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