当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript fs.chmod函数代码示例

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


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

示例1: function

            fs.exists(newDir, function (params:any, status:any) {
                console.log(params);
            if (status !== true) {
                fs.mkdir(newDir, function () {});
                fs.chmod(newDir, '777', function () {

                });

            } else {
                fs.chmod(newDir, '777', function () {

                });
            }


            });
开发者ID:richard457,项目名称:streamup-open,代码行数:16,代码来源:Dir.ts

示例2: async

	let disposable = commands.registerCommand('cake.bootstrapper', async () => {
        
        //check if there is an open folder in workspace
        if (workspace.rootPath === undefined) {
            window.showErrorMessage('You have not yet opened a folder.');
            return;
        }
        
        let bootstrapper = new Bootstrapper(process.platform);
        var buildFilePath = path.join(workspace.rootPath, bootstrapper.buildFilename);
        
        //check if there is a
        if (fs.existsSync(buildFilePath)) {
            var option = await window.showWarningMessage(`Overwrite the existing ${bootstrapper.buildFilename} file in this folder ?`, 'Overwrite');
            
            if (option !== 'Overwrite')
                return;
        }
        
        var file = fs.createWriteStream(buildFilePath);
        var result = await bootstrapper.download(file);

        if (result) {
            
            if (process.platform !== 'win32')
                fs.chmod(buildFilePath, 0o755);

            window.showInformationMessage('Cake bootstrapper downloaded successfully');
        } else {
            window.showErrorMessage('Error downloading Cake bootstrapper');
        }
	});
开发者ID:fabionuno,项目名称:cake-vscode,代码行数:32,代码来源:cakeExtension.ts

示例3: function

export const makePathExecutable = function (runPath: string, cb: ErrnoExceptionType) {
  
  if (runPath) {
    fs.chmod(runPath, 0o777, cb);
  }
  else {
    process.nextTick(cb);
  }
};
开发者ID:ORESoftware,项目名称:suman-utils,代码行数:9,代码来源:index.ts

示例4: reject

		const finish = (error?: Error) => {
			if (!finished) {
				finished = true;

				// in error cases, pass to callback
				if (error) {
					return reject(error);
				}

				// we need to explicitly chmod because of https://github.com/nodejs/node/issues/1104
				fs.chmod(target, mode, error => error ? reject(error) : resolve());
			}
		};
开发者ID:PKRoma,项目名称:vscode,代码行数:13,代码来源:pfs.ts

示例5: checkFileExists

 checkFileExists(file).then((exists: boolean) => {
     if (exists) {
         fs.chmod(file, '755', (err: NodeJS.ErrnoException) => {
             if (err) {
                 reject(err);
                 return;
             }
             resolve();
         });
     } else {
         getOutputChannel().appendLine("");
         getOutputChannel().appendLine(`Warning: Expected file ${file} is missing.`);
         resolve();
     }
 });
开发者ID:appTimesTV,项目名称:vscode-cpptools,代码行数:15,代码来源:common.ts

示例6: downloadKubectl

export async function downloadKubectl(version: string) : Promise<string> {
    var kubectlURL = getkubectlDownloadURL(version);
    var cachedToolpath = toolLib.findLocalTool(kubectlToolName, version);
    if(!cachedToolpath) {
        try {
                var KubectlDownloadPath = await toolLib.downloadTool(getkubectlDownloadURL(version)); 
        } catch(exception) {
            throw new Error(tl.loc("DownloadKubectlFailedFromLocation", getkubectlDownloadURL(version), exception));
        }

        cachedToolpath = await toolLib.cacheFile(KubectlDownloadPath, kubectlToolName + getExecutableExtention() , kubectlToolName, version);
    }
    
    var kubectlPath = path.join(cachedToolpath, kubectlToolName + getExecutableExtention());
    fs.chmod(kubectlPath, "777");
    return kubectlPath;
}
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:17,代码来源:kubectlutility.ts

示例7:

 fs.access(this.activeTextEditor.document.fileName, fs.W_OK, (accessErr) => {
     if (accessErr) {
         if (this.arguments.bang) {
             fs.chmod(this.activeTextEditor.document.fileName, 666, (e) => {
                 if (e) {
                     modeHandler.setupStatusBarItem(e.message);
                 } else {
                     this.save(modeHandler);
                 }
             });
         } else {
             modeHandler.setupStatusBarItem(accessErr.message);
         }
     } else {
         this.save(modeHandler);
     }
 });
开发者ID:CoderNumber1,项目名称:Vim,代码行数:17,代码来源:write.ts

示例8: getKubectl

 private async getKubectl() : Promise<string> {
     let versionOrLocation = tl.getInput("versionOrLocation");
     if( versionOrLocation === "location") {
         let pathToKubectl = tl.getPathInput("specifyLocation", true, true);
         fs.chmod(pathToKubectl, "777");
         return pathToKubectl;
     }
     else if(versionOrLocation === "version") {
         tl.debug(tl.loc("DownloadingClient"));
         var kubectlPath = path.join(this.userDir, "kubectl") + this.getExecutableExtention();
         let versionSpec = tl.getInput("versionSpec");
         let checkLatest: boolean = tl.getBoolInput('checkLatest', false);
         return utils.getKubectlVersion(versionSpec, checkLatest).then((version) => {
             return utils.downloadKubectl(version, kubectlPath);
         })
     }
 }
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:17,代码来源:clusterconnection.ts

示例9: installCakeBootstrapper

export async function installCakeBootstrapper()
{
  // Let the user select the bootstrapper.
  var info = await window.showQuickPick(CakeBootstrapper.getBootstrappers(), {
      "placeHolder": "Select the bootstrapper that you want to install",
      "matchOnDetail": true,
      "matchOnDescription": true
  });
  if (!info) {
      return;
  }

  // Check if there is an open folder in workspace
  if (workspace.rootPath === undefined) {
      window.showErrorMessage('You have not yet opened a folder.');
      return;
  }

  // Create the bootstrapper from the platform.
  let bootstrapper = new CakeBootstrapper(info);

  // Does the bootstrapper already exist?
  var buildFilePath = bootstrapper.getTargetPath();
  if (fs.existsSync(buildFilePath)) {
      var message = `Overwrite the existing \'${info.fileName}\' file in this folder?`;
      var option = await window.showWarningMessage(message, 'Overwrite');
      if (option !== 'Overwrite') {
          return;
      }
  }

  // Download the bootstrapper and save it to disk.
  var file = fs.createWriteStream(buildFilePath);
  var result = await bootstrapper.download(file);
  if (result) {
      if (process.platform !== 'win32' && info.posix) {
          fs.chmod(buildFilePath, 0o755);
      }
      window.showInformationMessage('Cake bootstrapper downloaded successfully.');
  } else {
      window.showErrorMessage('Error downloading Cake bootstrapper.');
  }
}
开发者ID:patriksvensson,项目名称:cake-vscode,代码行数:43,代码来源:cakeBootstrapperCommand.ts

示例10: execute

  async execute(vimState: VimState): Promise<void> {
    if (this.arguments.opt) {
      Message.ShowError('Not implemented.');
      return;
    } else if (this.arguments.file) {
      Message.ShowError('Not implemented.');
      return;
    } else if (this.arguments.append) {
      Message.ShowError('Not implemented.');
      return;
    } else if (this.arguments.cmd) {
      Message.ShowError('Not implemented.');
      return;
    }

    if (vimState.editor.document.isUntitled) {
      await vscode.commands.executeCommand('workbench.action.files.save');
      return;
    }

    try {
      await util.promisify(fs.access)(vimState.editor.document.fileName, fs.constants.W_OK);
      return this.save(vimState);
    } catch (accessErr) {
      if (this.arguments.bang) {
        fs.chmod(vimState.editor.document.fileName, 666, e => {
          if (!e) {
            return this.save(vimState);
          }
          StatusBar.SetText(e.message, vimState.currentMode, vimState.isRecordingMacro, true, true);
          return;
        });
      } else {
        StatusBar.SetText(
          accessErr.message,
          vimState.currentMode,
          vimState.isRecordingMacro,
          true,
          true
        );
      }
    }
  }
开发者ID:arussellk,项目名称:Vim,代码行数:43,代码来源:write.ts


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