當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。