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


TypeScript fs.chmodSync函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。