本文整理汇总了TypeScript中temp.path函数的典型用法代码示例。如果您正苦于以下问题:TypeScript path函数的具体用法?TypeScript path怎么用?TypeScript path使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了path函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: convertAmendmentToUTF8
static convertAmendmentToUTF8 (htmlPath) {
// Convert amendment to UTF-8.
// TODO: This should move into Amender.
var amendmentHtml = Helpers.recode(htmlPath)
// Remove html comments.
amendmentHtml = amendmentHtml.replace(/<!--[\s\S]*?-->/g, '')
amendmentHtml = amendmentHtml.replace(/<o:p>[\s\S]*?<\/o:p>/g, '')
var p = temp.path({suffix: '.html'})
fs.writeFileSync(p, amendmentHtml)
return amendmentHtml
}
示例2: readFile
// TODO: Remove this method from here. It has nothing to do with platform
public async readFile(device: Mobile.IDevice, deviceFilePath: string, projectData: IProjectData): Promise<string> {
temp.track();
const uniqueFilePath = temp.path({ suffix: ".tmp" });
const platform = device.deviceInfo.platform.toLowerCase();
try {
await device.fileSystem.getFile(deviceFilePath, projectData.projectIdentifiers[platform], uniqueFilePath);
} catch (e) {
return null;
}
if (this.$fs.exists(uniqueFilePath)) {
const text = this.$fs.readText(uniqueFilePath);
shell.rm(uniqueFilePath);
return text;
}
return null;
}
示例3: fullSync
@performanceLog()
public async fullSync(syncInfo: IFullSyncInfo): Promise<ILiveSyncResultInfo> {
const device = syncInfo.device;
if (device.isEmulator) {
return super.fullSync(syncInfo);
}
const projectData = syncInfo.projectData;
const platformData = this.$platformsData.getPlatformData(device.deviceInfo.platform, projectData);
const deviceAppData = await this.getAppData(syncInfo);
const projectFilesPath = path.join(platformData.appDestinationDirectoryPath, APP_FOLDER_NAME);
temp.track();
const tempZip = temp.path({ prefix: "sync", suffix: ".zip" });
const tempApp = temp.mkdirSync("app");
this.$logger.trace("Creating zip file: " + tempZip);
this.$fs.copyFile(path.join(path.dirname(projectFilesPath), `${APP_FOLDER_NAME}/*`), tempApp);
if (!syncInfo.syncAllFiles) {
this.$fs.deleteDirectory(path.join(tempApp, TNS_MODULES_FOLDER_NAME));
}
await this.$fs.zipFiles(tempZip, this.$fs.enumerateFilesInDirectorySync(tempApp), (res) => {
return path.join(APP_FOLDER_NAME, path.relative(tempApp, res));
});
await device.fileSystem.transferFiles(deviceAppData, [{
getLocalPath: () => tempZip,
getDevicePath: () => deviceAppData.deviceSyncZipPath,
getRelativeToProjectBasePath: () => "../sync.zip",
deviceProjectRootPath: await deviceAppData.getDeviceProjectRootPath()
}]);
return {
deviceAppData,
isFullSync: true,
modifiedFilesData: [],
useHotModuleReload: syncInfo.useHotModuleReload
};
}
示例4: testPath
function testPath() {
const p = temp.path({ suffix: "justSuffix" }, "defaultPrefix");
p.length;
const p2: string = temp.path("prefix");
const p3: string = temp.path({ prefix: "prefix" });
}
示例5: testPath
function testPath() {
const p = temp.path({ suffix: "justSuffix" }, "defaultPrefix");
p.length;
}