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