Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

co-readline

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

co-readline - npm Package Compare versions

Comparing version 0.0.1 to 1.2.0

.idea/co-readline.iml

24

package.json
{
"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
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc