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


TypeScript byline类代码示例

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


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

示例1: GitLFSProgressParser

  return process => {
    if (lfsProgressPath) {
      const lfsParser = new GitLFSProgressParser()
      const disposable = tailByLine(lfsProgressPath, line => {
        const progress = lfsParser.parse(line)
        progressCallback(progress)
      })

      process.on('close', () => {
        disposable.dispose()
        // the order of these callbacks is important because
        //  - unlink can only be done on files
        //  - rmdir can only be done when the directory is empty
        //  - we don't want to surface errors to the user if something goes
        //    wrong (these files can stay in TEMP and be cleaned up eventually)
        Fs.unlink(lfsProgressPath, err => {
          if (err == null) {
            const directory = Path.dirname(lfsProgressPath)
            Fs.rmdir(directory, () => {})
          }
        })
      })
    }

    byline(process.stderr).on('data', (line: string) => {
      progressCallback(parser.parse(line))
    })
  }
开发者ID:ghmoore,项目名称:desktop,代码行数:28,代码来源:from-process.ts

示例2: byline

	return new Promise<boolean>((c, e) => {
		const fileStream = fs.createReadStream(filename, { encoding: 'utf8' });
		const stream = byline(fileStream);
		stream.on('data', (line: string) => {
			if (pattern.test(line)) {
				fileStream.close();
				c(true);
			}
		});

		stream.on('error', e);
		stream.on('end', () => c(false));
	});
开发者ID:KTXSoftware,项目名称:KodeStudio,代码行数:13,代码来源:util.ts

示例3: createStream

  private createStream(file) {
    if (this.handleGzip(file)) {
      const lineStream = new LineStream();
      fs.createReadStream(file)
        .pipe(zlib.createGunzip())
        .pipe(lineStream);

      return lineStream;
    }

    return byline(fs.createReadStream(file, {
      encoding: 'utf-8'
    }));
  }
开发者ID:nspragg,项目名称:filesniffer,代码行数:14,代码来源:filesniffer.ts

示例4: GitLFSProgressParser

  return process => {
    if (lfsProgressPath) {
      const lfsParser = new GitLFSProgressParser()
      const disposable = tailByLine(lfsProgressPath, line => {
        const progress = lfsParser.parse(line)
        progressCallback(progress)
      })

      process.on('close', () => {
        disposable.dispose()
        // NB: We don't really care about errors deleting the file, but Node
        // gets kinda bothered if we don't provide a callback.
        Fs.unlink(lfsProgressPath, () => {})
      })
    }

    byline(process.stderr).on('data', (line: string) => {
      progressCallback(parser.parse(line))
    })
  }
开发者ID:Ahskys,项目名称:desktop,代码行数:20,代码来源:from-process.ts

示例5: byline

 return process => {
   byline(process.stderr).on('data', (line: string) => {
     progressCallback(parser.parse(line))
   })
 }
开发者ID:tamdao,项目名称:desktop,代码行数:5,代码来源:from-process.ts


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