当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript temp.path函数代码示例

本文整理汇总了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
 }
开发者ID:OpenParliamentAu,项目名称:law-tools,代码行数:11,代码来源:helpers.ts

示例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;
	}
开发者ID:NativeScript,项目名称:nativescript-cli,代码行数:19,代码来源:platform-service.ts

示例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
		};
	}
开发者ID:NativeScript,项目名称:nativescript-cli,代码行数:40,代码来源:ios-livesync-service.ts

示例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" });
}
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:6,代码来源:temp-tests.ts

示例5: testPath

function testPath() {
    const p = temp.path({ suffix: "justSuffix" }, "defaultPrefix");
    p.length;
}
开发者ID:teves-castro,项目名称:DefinitelyTyped,代码行数:4,代码来源:temp-tests.ts


注:本文中的temp.path函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。