本文整理汇总了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;未经允许,请勿转载。 |
请发表评论