File tree Expand file tree Collapse file tree 6 files changed +2423
-0
lines changed
Expand file tree Collapse file tree 6 files changed +2423
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "presets" : [
3+ [
4+ " @babel/preset-env" ,
5+ {
6+ "targets" : {
7+ "node" : " current"
8+ }
9+ }
10+ ]
11+ ],
12+ "plugins" : [" @babel/plugin-transform-async-to-generator" ]
13+ }
14+
Original file line number Diff line number Diff line change 1+ # Logs
2+ logs
3+ * .log
4+ npm-debug.log *
5+ yarn-debug.log *
6+ yarn-error.log *
7+
8+ # Runtime data
9+ pids
10+ * .pid
11+ * .seed
12+ * .pid.lock
13+
14+ # Directory for instrumented libs generated by jscoverage/JSCover
15+ lib-cov
16+
17+ # Coverage directory used by tools like istanbul
18+ coverage
19+
20+ # nyc test coverage
21+ .nyc_output
22+
23+ # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+ .grunt
25+
26+ # Bower dependency directory (https://bower.io/)
27+ bower_components
28+
29+ # node-waf configuration
30+ .lock-wscript
31+
32+ # Compiled binary addons (http://nodejs.org/api/addons.html)
33+ build /Release
34+
35+ # Dependency directories
36+ node_modules /
37+ jspm_packages /
38+
39+ # Typescript v1 declaration files
40+ typings /
41+
42+ # Optional npm cache directory
43+ .npm
44+
45+ # Optional eslint cache
46+ .eslintcache
47+
48+ # Optional REPL history
49+ .node_repl_history
50+
51+ # Output of 'npm pack'
52+ * .tgz
53+
54+ # dotenv environment variables file
55+ .env
56+
57+ # gatsby files
58+ .cache /
59+ public
60+
61+ # Mac files
62+ .DS_Store
63+
64+ # Yarn
65+ yarn-error.log
66+ .pnp /
67+ .pnp.js
68+ # Yarn Integrity file
69+ .yarn-integrity
70+
71+ lib
Original file line number Diff line number Diff line change 1+ # Introduction
2+
3+ The implementation of [ n-readlines] ( https://github.com/nacholibre/node-readlines ) provides an elegant method to read a text file line-by-line.
4+
5+ # Objectives
6+
7+ # Implementation
8+
9+ ``` sh
10+ npm install n-readlines --save
11+ # or
12+ yarn add n-readlines
13+ ```
14+
15+ ``` javascript
16+ import LineByLine from ' n-readlines'
17+
18+ const fname = process .argv [2 ]
19+ const reader = new LineByLine (fname)
20+
21+ let line = ' '
22+
23+ while (line = reader .next ()) {
24+ console .log (line .toString (' utf8' ))
25+ }
26+ ```
27+
28+ # References
29+ - [ n-readlines] ( https://github.com/nacholibre/node-readlines )
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " n-readlines" ,
3+ "version" : " 1.0.0" ,
4+ "main" : " index.js" ,
5+ "license" : " MIT" ,
6+ "scripts" : {
7+ "build" : " ./node_modules/.bin/babel --version && ./node_modules/.bin/babel src -d lib" ,
8+ "start" : " node lib/index.js"
9+ },
10+ "devDependencies" : {
11+ "@babel/cli" : " ^7.7.7" ,
12+ "@babel/core" : " ^7.7.7" ,
13+ "@babel/plugin-transform-async-to-generator" : " ^7.7.4" ,
14+ "@babel/preset-env" : " ^7.7.7"
15+ },
16+ "dependencies" : {
17+ "n-readlines" : " ^1.0.0"
18+ }
19+ }
Original file line number Diff line number Diff line change 1+ import LineByLine from 'n-readlines'
2+
3+ const fname = process . argv [ 2 ]
4+ const reader = new LineByLine ( fname )
5+
6+ let line = ''
7+
8+ while ( line = reader . next ( ) ) {
9+ console . log ( line . toString ( 'utf8' ) )
10+ }
You can’t perform that action at this time.
0 commit comments