當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。