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


TypeScript fs.exists函数代码示例

本文整理汇总了TypeScript中q-io/fs.exists函数的典型用法代码示例。如果您正苦于以下问题:TypeScript exists函数的具体用法?TypeScript exists怎么用?TypeScript exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了exists函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: printTailAndWatchFile

async function printTailAndWatchFile(file:any, tailSize:number) {
    if (await qfs.exists(file)) {
      const content = await qfs.read(file)
      const lines = content.split('\n')
      const from = Math.max(0, lines.length - tailSize)
      const lastLines = lines.slice(from).join('\n')
      console.log(lastLines)
    }
    watchFile(file)
}
开发者ID:duniter,项目名称:duniter,代码行数:10,代码来源:daemon.ts

示例2: async

 getHomeParams: async (isMemory:boolean, theHome:string) => {
   const params:any = await dir.getHomeFS(isMemory, theHome)
   const home = params.home;
   if (isMemory) {
     params.dbf = () => new SQLiteDriver(':memory:');
     params.wotb = WoTBObject.memoryInstance();
   } else {
     const sqlitePath = path.join(home, dir.DUNITER_DB_NAME + '.db');
     params.dbf = () => new SQLiteDriver(sqlitePath);
     const wotbFilePath = path.join(home, dir.WOTB_FILE);
     let existsFile = await qfs.exists(wotbFilePath)
     if (!existsFile) {
       fs.closeSync(fs.openSync(wotbFilePath, 'w'));
     }
     params.wotb = WoTBObject.fileInstance(wotbFilePath);
   }
   return params;
 },
开发者ID:Kalmac,项目名称:duniter,代码行数:18,代码来源:directory.ts

示例3:

				return this.core.content.loadContent(file).progress(d.notify).then(() => {
					// check again? (race?)
					return FS.exists(targetPath);
				}).then((exists) => {
开发者ID:AbraaoAlves,项目名称:tsd,代码行数:4,代码来源:Installer.ts

示例4:

voidQ = fs.move(source, target);

voidQ = fs.link(source, target);

voidQ = fs.symbolicCopy(source, target, type);
voidQ = fs.symbolicLink(target, str, type);

voidQ = fs.chown(path, num, num);
voidQ = fs.chmod(path, str);
voidQ = fs.chmod(path, num);

statsQ = fs.stat(path)
statsQ = fs.statLink(path);
statsQ = fs.statFd(num);

boolQ = fs.exists(path);

boolQ = fs.isFile(path);
boolQ = fs.isDirectory(path);
boolQ = fs.isSymbolicLink(path);

dateQ = fs.lastModified(path);
dateQ = fs.lastAccessed(path);

strArr = fs.split(path);
str = fs.join(str, str);
str = fs.join(strArr);
str = fs.resolve(str, str);
str = fs.resolve(strArr);
str = fs.normal(str, str);
str = fs.normal(strArr);
开发者ID:3x14159265,项目名称:DefinitelyTyped,代码行数:31,代码来源:Q-io-tests.ts


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