# rxjs-file

> RxJS File utils

Latest version **0.3.0** (published 2020-09-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install rxjs-file
pnpm add rxjs-file
yarn add rxjs-file
bun add rxjs-file
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2020-09-06 |
| First published | 2018-08-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 10 |
| Dependencies | 1 |
| Unpacked size | 417.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Roland Groza |
| Maintainers | rolandjitsu |
| Keywords | rxjs, file, utils |

## Links

- npm: https://www.npmjs.com/package/rxjs-file
- Homepage: https://github.com/rolandjitsu/rxjs-file
- npm.io page: https://npm.io/package/rxjs-file

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.0.1

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.3.0 (latest) — 2020-09-06
- 0.2.0 — 2018-08-31
- 0.1.2 — 2018-08-30
- 0.1.1 — 2018-08-30

## README

# RxJS File

> A small package with a couple of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) utils for [RxJS](https://rxjs-dev.firebaseapp.com/).

[![npm](https://img.shields.io/npm/v/rxjs-file.svg?style=flat-square)](https://www.npmjs.com/package/rxjs-file)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/rolandjitsu/rxjs-file/Test?label=tests&style=flat-square)](https://github.com/rolandjitsu/rxjs-file/actions?query=workflow%3ATest)
[![Coveralls github branch](https://img.shields.io/coveralls/github/rolandjitsu/rxjs-file/master?style=flat-square)](https://coveralls.io/github/rolandjitsu/rxjs-file?branch=master)


# Table of Contents

* [Installation](#installation)
* [Usage](#usage)
* [Contribute](#contribute)


### Installation
----------------
You can install this package from [NPM](https://www.npmjs.com):
```bash
npm add rxjs rxjs-file
```

Or with [Yarn](https://yarnpkg.com/en):
```bash
yarn add rxjs rxjs-file
```

#### CDN
For CDN, you can use [unpkg](https://unpkg.com):

[https://unpkg.com/rxjs-file/dist/bundles/rxjs-file.umd.min.js](https://unpkg.com/rxjs-file/dist/bundles/rxjs-file.umd.min.js)

The global namespace for rxjs-file is `rxjsFile`:
```js
const {toArrayBuffer} = rxjsFile;

toArrayBuffer(file)
    .subscribe(buffer => {
        // Do something with the buffer 
    });
```


### Usage
---------

#### ES6
Read a file as [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer):
```ts
import {toArrayBuffer} from 'rxjs-file';

toArrayBuffer(file)
    .subscribe(buffer => {
        // Do something with the buffer 
    });
```

Read the file as ArrayBuffer in chunks:
```ts
import {toArrayBuffer} from 'rxjs-file';

toArrayBuffer(file, {chunkSize: 1000 /* bytes */})
    .subscribe(chunk => {
        // Do something with each chunk
    });
```

Read a file as text:
```ts
import {toString} from 'rxjs-file';

toString(file)
    .subscribe(str => {
        // Do something with the string
    });
```

#### CommonJS
Read a file as ArrayBuffer:
```ts
const {toArrayBuffer} = require('rxjs-file');

toArrayBuffer(file)
    .subscribe(buffer => {
        // Do something with the buffer 
    });
```

### Contribute
--------------
If you wish to contribute, please use the following guidelines:
* Use [Conventional Commits](https://conventionalcommits.org)
* Use `[ci skip]` in commit messages to skip a build

---
_Source: https://npm.io/package/rxjs-file · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
