本文整理汇总了TypeScript中tmp.dir函数的典型用法代码示例。如果您正苦于以下问题:TypeScript dir函数的具体用法?TypeScript dir怎么用?TypeScript dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dir函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Promise
return new Promise<String>((resolve, reject) => {
tmp.dir((error, tmpDir) => {
if (error) { return reject(error); }
var ptVSToolsPath = path.join(path.dirname(currentFileName), "..", "..", "..", "..", "pythonFiles", "PythonTools");
var promises = PTVS_FILES.map(ptvsFile=> {
return new Promise((copyResolve, copyReject) => {
var sourceFile = path.join(ptVSToolsPath, ptvsFile);
var targetFile = path.join(tmpDir, ptvsFile);
fsExtra.copy(sourceFile, targetFile, copyError=> {
if (copyError) { return copyReject(copyError); }
copyResolve(targetFile);
});
});
});
Promise.all(promises).then(() => {
resolve(path.join(tmpDir, "visualstudio_py_launcher.py"));
}, reject);
});
});
示例2: Promise
return new Promise((resolve, reject) => {
dir(options, (err, ...args) => {
if (err) return reject(err);
return resolve(args[0])
})
});
示例3: Promise
return new Promise( (res, rej) => {
Tmp.dir(options, (err, path) => {
if (err) rej(err)
else res(path)
})
})
示例4: file
tmpNameSync
} from "tmp";
file((err, name, fd, removeCallback) => {
if (err) throw err;
console.log("File name: ", name);
console.log("File descriptor: ", fd);
removeCallback();
});
dir((err, name, removeCallback) => {
if (err) throw err;
console.log("Dir name: ", name);
removeCallback();
});
tmpName((err, name) => {
if (err) throw err;
console.log("Created temporary filename: ", name);
});
file({ mode: 644, prefix: "prefix-", postfix: ".txt" }, (err, name, fd) => {
if (err) throw err;
console.log("File name: ", name);
console.log("File descriptor: ", fd);