co-readline
Advanced tools
Comparing version 0.0.1 to 1.2.0
{ | ||
"name": "co-readline", | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "index.js", | ||
"version": "1.2.0", | ||
"description": "Read a file line by line in generator/co style", | ||
"repository": "https://github.com/alsotang/co-readline", | ||
"main": "lib/co_readline.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "make test" | ||
}, | ||
"author": "alsotang <alsotang@gmail.com>", | ||
"license": "MIT" | ||
"license": "MIT", | ||
"devDependencies": { | ||
"co": "^4.6.0", | ||
"debug": "^2.3.3", | ||
"istanbul": "^0.4.5", | ||
"matcha": "^0.7.0", | ||
"mocha": "^3.2.0", | ||
"ms": "^0.7.2", | ||
"mz": "^2.6.0", | ||
"should": "^11.1.1" | ||
}, | ||
"dependencies": { | ||
"bluebird": "^3.4.6" | ||
} | ||
} |
@@ -1,1 +0,50 @@ | ||
not implement yet | ||
# co-readline | ||
[![Build Status](https://travis-ci.org/alsotang/co-readline.svg?branch=master)](https://travis-ci.org/alsotang/co-readline) | ||
[![codecov](https://codecov.io/gh/alsotang/co-readline/branch/master/graph/badge.svg)](https://codecov.io/gh/alsotang/co-readline) | ||
Read a file line by line in generator/co style. | ||
## install | ||
`$ npm i co-readline` | ||
## easy example | ||
```js | ||
var coReadline = require('co-readline') | ||
var co = require('co') | ||
co(function * () { | ||
var NORMAL_FILE_PATH = 'absolute_path_to_file' | ||
var rlGen = coReadline(NORMAL_FILE_PATH) | ||
var lines = [] | ||
for (var line of rlGen) { | ||
if (line.then) { // `line` could be Promise or String | ||
line = yield line; | ||
} | ||
lines.push(line) | ||
} | ||
var fileContent = yield fs.readFile(NORMAL_FILE_PATH, 'utf-8') | ||
fileContent.should.equal(lines.join('\n')) | ||
}) | ||
``` | ||
## api | ||
`coReadline(filePath)` return a generator, then do `for..of` to it | ||
## benchmark | ||
About 1/3 speed of build-in `readline` module | ||
About 1/6 speed of `fs.readFileSync` | ||
Read about 1 million lines per second |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
46979
20
261
1
51
1
8
4
+ Addedbluebird@^3.4.6
+ Addedbluebird@3.7.2(transitive)