gen-readlines:基于Node.js生成器的行读取器

时间:2021-05-10 05:55:15
【文件属性】:
文件名称:gen-readlines:基于Node.js生成器的行读取器
文件大小:334KB
文件格式:ZIP
更新时间:2021-05-10 05:55:15
TypeScript gen-readlines 基于生成器的行读取器。 当给定文件描述符和文件大小时,此节点包将返回文件的行作为生成器。 为什么? 我创建此项目的主要目的是为了更好地控制文件中读取行的流。 与其使用回调来读取文件中的行,不如使用一个具有一些独特好处的生成器。 由于它是生成器,因此文件的行不会存储在较大的数组中 代码是同步的,因此您不必担心等待回调的异步影响 性能优异,我们的微基准测试表明它可以与基于回调的行读取器竞争,并且实际上速度更快。 而且,没有外部依赖关系,并且该库是使用TypeScript构建的。 安装 npm install gen-readlines 用法 import { fromFile } from 'gen-readlines' ; async function readFile ( ) { for ( let line of fromFile ( './fil
【文件预览】:
gen-readlines-master
----.gitignore(38B)
----.eslintrc(842B)
----package.json(1KB)
----LICENSE.md(1KB)
----tsconfig.json(1KB)
----.github()
--------workflows()
----perf()
--------linebyline.js(303B)
--------gen-readlines.js(395B)
--------tale_two_cities.txt(779KB)
--------line-reader.js(297B)
--------byline.js(375B)
--------readline.js(379B)
----README.md(5KB)
----prettier.config.js(116B)
----index.ts(4KB)
----test_data()
--------empty_file.txt(0B)
--------cr_alone.txt(36B)
--------empty_lines.txt(70B)
--------multibyte_file.txt(259B)
--------hipster_windos.txt(3KB)
--------one_line_file.txt(14B)
--------normal_file.txt(86B)
--------multibyte_windos_file.txt(263B)
--------hipster.txt(3KB)
--------three_line_file.txt(56B)
----CHANGES.md(1KB)
----.npmignore(65B)
----.gitattributes(25B)
----test()
--------tests.ts(8KB)
--------tests-simplified.ts(4KB)
----yarn.lock(50KB)

网友评论