本文整理汇总了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}"`));
}
});
示例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.");
});
}
}
示例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.");
});
}
}
示例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);
});
示例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.");
});
}
}
示例6: Promise
return new Promise((resolve, reject) => {
fs.symlink(target, this.path, err => {
err ? reject(err) : resolve();
});
});
示例7: Promise
await new Promise((c, e) => fs.symlink(debug2Path, path.join(app.extensionsPath, 'vscode-node-debug2'), err => err ? e(err) : c()));
示例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!');
});
示例9: symlink
const linkDirs = (sourceDir: string, destDir: string, callback: NodeBack) => {
const type = (process.platform === 'win32') ? 'junction' : 'dir';
symlink(sourceDir, destDir, type, callback);
};