GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - cojs/readable: Easy way to read stream data with co

BranchesTags
Open more actions menu

Latest commit

 

History

10 Commits
10 Commits

Folders and files

NameName
Last commit message
Last commit date
test
test
 
 
.eslintrc
.eslintrc
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
AUTHORS
AUTHORS
 
 
History.md
History.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
index.js
index.js
 
 
package.json
package.json
 
 

Repository files navigation

co-readable

NPM version build status Test coverage Gittip David deps npm download

Easy way to read stream data with co.

Install

$ npm i co-readable

Usage

readable(stream)

Read a stream data buffer piece by piece.

const fs = require('fs');
const readable = require('co-readable');
const co = require('co');

const read = readable(fs.createReadStream('bigfile'));

co(function* () {
  let buf;
  let size = 0;
  while (buf = yield read(1024)) {
    console.log('read %d bytes', buf.length);
    size += buf.length;
  }
  console.log('total read %d bytes', size);
}).catch(function (err) {
  console.error(err.stack);
});

readable.readAll(stream)

Read all data into one buffer.

const fs = require('fs');
const readable = require('co-readable');
const co = require('co');

co(function* () {
  const buf = yield readable.readAll(fs.createReadStream('bigfile'));
  console.log('total read %d bytes', buf.length);
}).catch(function (err) {
  console.error(err.stack);
});

License

MIT

About

Easy way to read stream data with co

Resources

Readme
License
Activity
Custom properties

Stars

6 stars

Watchers

3 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.