Skip to content

Commit

Permalink
Rename then-read-stream to peek-readable
Browse files Browse the repository at this point in the history
  • Loading branch information
Borewit committed Jan 6, 2020
1 parent e73779e commit 7ecb159
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
38 changes: 20 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
[![Build Status](https://travis-ci.org/Borewit/then-read-stream.svg?branch=master)](https://travis-ci.org/Borewit/then-read-stream)
[![NPM version](https://badge.fury.io/js/then-read-stream.svg)](https://npmjs.org/package/then-read-stream)
[![npm downloads](http://img.shields.io/npm/dm/then-read-stream.svg)](https://npmcharts.com/compare/then-read-stream?start=600&interval=30)
[![Dependencies](https://david-dm.org/Borewit/then-read-stream.svg)](https://david-dm.org/Borewit/then-read-stream)
[![Coverage Status](https://coveralls.io/repos/github/Borewit/then-read-stream/badge.svg?branch=master)](https://coveralls.io/github/Borewit/then-read-stream?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/8a89b90858734a6da07570eaf2e89849)](https://www.codacy.com/app/Borewit/then-read-stream?utm_source=github.com&utm_medium=referral&utm_content=Borewit/then-read-stream&utm_campaign=Badge_Grade)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/Borewit/then-read-stream.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/then-read-stream/alerts/)
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/Borewit/then-read-stream.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/then-read-stream/context:javascript)
[![Known Vulnerabilities](https://snyk.io/test/github/Borewit/then-read-stream/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/then-read-stream?targetFile=package.json)

# then-read-stream
[![Build Status](https://travis-ci.org/Borewit/peek-readable.svg?branch=master)](https://travis-ci.org/Borewit/peek-readable)
[![NPM version](https://badge.fury.io/js/peek-readable.svg)](https://npmjs.org/package/peek-readable)
[![npm downloads](http://img.shields.io/npm/dm/peek-readable.svg)](https://npmcharts.com/compare/peek-readable?start=600&interval=30)
[![Dependencies](https://david-dm.org/Borewit/peek-readable.svg)](https://david-dm.org/Borewit/peek-readable)
[![Coverage Status](https://coveralls.io/repos/github/Borewit/peek-readable/badge.svg?branch=master)](https://coveralls.io/github/Borewit/peek-readable?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/8a89b90858734a6da07570eaf2e89849)](https://www.codacy.com/app/Borewit/peek-readable?utm_source=github.com&utm_medium=referral&utm_content=Borewit/peek-readable&utm_campaign=Badge_Grade)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/Borewit/peek-readable.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/peek-readable/alerts/)
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/Borewit/peek-readable.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/peek-readable/context:javascript)
[![Known Vulnerabilities](https://snyk.io/test/github/Borewit/peek-readable/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/peek-readable?targetFile=package.json)

# peek-readable

A promise based asynchronous stream reader, which makes reading from a stream easy.

Allows to read from a [Readable Stream](https://nodejs.org/api/stream.html#stream_readable_streams)
similar as you would read from a file.
Allows to read and peek from a [Readable Stream](https://nodejs.org/api/stream.html#stream_readable_streams)

## Usage

### Installation

```shell script
npm install --save then-read-stream
npm install --save peek-readable
```

The `then-read-stream` contains one class: `StreamReader`, which reads from a [stream.Readable](https://nodejs.org/api/stream.html#stream_class_stream_readable).
The `peek-readable` contains one class: `StreamReader`, which reads from a [stream.Readable](https://nodejs.org/api/stream.html#stream_class_stream_readable).

### Compatibility

Expand All @@ -36,7 +35,7 @@ Source code of examples can be found [here](test/examples.ts).

```js
const fs = require('fs');
const { StreamReader } = require('then-read-stream');
const { StreamReader } = require('peek-readable');

(async () => {

Expand Down Expand Up @@ -71,7 +70,7 @@ End-of-stream detection:
With peek you can read ahead:
```js
const fs = require('fs');
const { StreamReader } = require('then-read-stream');
const { StreamReader } = require('peek-readable');

const fileReadStream = fs.createReadStream('JPEG_example_JPG_RIP_001.jpg');
const streamReader = new StreamReader(fileReadStream);
Expand All @@ -96,6 +95,9 @@ const buffer = Buffer.alloc(20);

If you have to skip a part of the data, you can use ignore:
```js
await streamReader.ignore(16);
(async () => {
//...
await streamReader.ignore(16);
})();
```

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "then-read-stream",
"name": "peek-readable",
"version": "3.0.0",
"description": "Read from a readable stream just like a file",
"description": "Read and peek from a readable stream",
"author": {
"name": "Borewit",
"url": "https://github.com/Borewit"
Expand All @@ -25,13 +25,13 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/Borewit/then-read-stream"
"url": "git+https://github.com/Borewit/peek-readable"
},
"license": "MIT",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"bugs": {
"url": "https://github.com/Borewit/then-read-stream/issues"
"url": "https://github.com/Borewit/peek-readable/issues"
},
"files": [
"lib/**/*.js",
Expand Down

0 comments on commit 7ecb159

Please sign in to comment.