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


TypeScript fs.symlink函數代碼示例

本文整理匯總了TypeScript中fs.symlink函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript symlink函數的具體用法?TypeScript symlink怎麽用?TypeScript symlink使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了symlink函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: lstat

 lstat(sourcePath, (error, sourceStats) => {
   if (error) return callback(error);
   if (sourceStats.isDirectory()) {
     // if source is a directory, mkdir a new directory at targetPath and recurse
     mkdir_p(targetPath, error => {
       if (error) return callback(error);
       readdir(sourcePath, (error, files) => {
         if (error) return callback(error);
         const sourcePairs = files.map(file => [file, join(sourcePath, file)]);
         const includedSourcePairs = sourcePairs.filter(([_, source]) => !ignoreFunction(source));
         async.each(includedSourcePairs, ([file, source], callback) => {
           const target = join(targetPath, file);
           link(source, target, ignoreFunction, callback);
         }, callback);
       });
     });
   }
   else if (sourceStats.isSymbolicLink() || sourceStats.isFile()) {
     log(`${sourcePath} <- ${targetPath}`);
     // type declarations are incorrect; symlink should be overloaded with three arguments
     symlink(sourcePath, targetPath, null, callback);
   }
   else {
     callback(new Error(`Cannot link unusual source file: "${sourcePath}"`));
   }
 });
開發者ID:chbrown,項目名稱:npm-reallink,代碼行數:26,代碼來源:index.ts

示例2: createSymbolicToNode

 // create symbolic
 static createSymbolicToNode(name: string) {
   //  let userPath = __dirname + "/../../node_modules/app/models/ScriptServer.js";
   // let execPath = __dirname + "/../../app/models/ScriptServer.js";
   let userPath = __dirname + "/../../node_modules/app";
   let execPath = __dirname + "/../../app";
   let fs = require("fs");
   if (!fs.existsSync(userPath)) {
     fs.symlink(execPath, userPath, (err) => {
       console.log(err || "Done.");
     });
   }
 }
開發者ID:takeo-asai,項目名稱:ElectronWidgets,代碼行數:13,代碼來源:Link.ts

示例3: createScriptPath

  // create symbolic link to Script.js to angular & command line tools
  static createScriptPath() {
    let userPath = Electron.app.getPath("userData") + "/Script.js";
    // let execPath = __dirname + "/../../build/app.js";
    let execPath = __dirname + "/Script.js";

    let fs = require("fs");
    if (!fs.existsSync(userPath)) {
      fs.symlink(execPath, userPath, (err) => {
        console.log(err || "Done.");
      });
    }
  }
開發者ID:takeo-asai,項目名稱:ElectronWidgets,代碼行數:13,代碼來源:Link.ts

示例4: function

	grunt.registerTask('_link', '', function (this: ITask) {
		const done = this.async();
		const packagePath = pkgDir.sync(process.cwd());
		const targetPath = grunt.config('distDirectory');

		fs.symlink(
			path.join(packagePath, 'node_modules'),
			path.join(targetPath, 'node_modules'),
			'junction',
			() => {}
		);
		fs.symlink(
			path.join(packagePath, 'package.json'),
			path.join(targetPath, 'package.json'),
			'file',
			() => {}
		);

		execa.shell('npm link', { cwd: targetPath })
			.then((result: any) => grunt.log.ok(result.stdout))
			.then(done);
	});
開發者ID:dylans,項目名稱:grunt-dojo2,代碼行數:22,代碼來源:link.ts

示例5: create

  static create() {
    let userPath = Electron.app.getPath("userData") + "/Script.js";
    let execPath = __dirname + "/Script.js";

    // if already exists, skip create a symlink
    let fs = require("fs");
    let stats = fs.lstatSync(userPath);
    if (!stats.isSymbolicLink()) {
      fs.symlink(execPath, userPath, (err) => {
        console.log(err || "Done.");
      });
    }
  }
開發者ID:takeo-asai,項目名稱:Electron_app,代碼行數:13,代碼來源:Symlink.ts

示例6: Promise

		return new Promise((resolve, reject) => {
			fs.symlink(target, this.path, err => {
				err ? reject(err) : resolve();
			});
		});
開發者ID:AdmiralZachbar,項目名稱:Pokemon-Showdown,代碼行數:5,代碼來源:fs.ts

示例7: Promise

			await new Promise((c, e) => fs.symlink(debug2Path, path.join(app.extensionsPath, 'vscode-node-debug2'), err => err ? e(err) : c()));
開發者ID:SeanKilleen,項目名稱:vscode,代碼行數:1,代碼來源:debug.test.ts

示例8:

import pathHelper from '../helpers/pathHelper';
import * as fs from 'fs';

let originalPath = pathHelper.getRelative('typings');
let destinationPath = pathHelper.getRelative('client', 'typings');

fs.symlink(originalPath, destinationPath, 'dir', (err) => {
    if (err) return console.log(err);

    console.log('Symlink successfully created!');
});
開發者ID:Blocklevel,項目名稱:contoso-express,代碼行數:11,代碼來源:typingsSymLink.ts

示例9: symlink

const linkDirs = (sourceDir: string, destDir: string, callback: NodeBack) => {
  const type = (process.platform === 'win32') ? 'junction' : 'dir';
  symlink(sourceDir, destDir, type, callback);
};
開發者ID:julianlam,項目名稱:nodebb-plugin-emoji,代碼行數:4,代碼來源:build.ts


注:本文中的fs.symlink函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。