# random-access-chrome-file

> random-access-storage instance backed by the Chrome file system api.

Latest version **1.2.0** (published 2021-11-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install random-access-chrome-file
pnpm add random-access-chrome-file
yarn add random-access-chrome-file
bun add random-access-chrome-file
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2021-11-24 |
| First published | 2018-08-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Mathias Buus |
| Maintainers | tinchoz49, mafintosh |

## Links

- npm: https://www.npmjs.com/package/random-access-chrome-file
- Repository: https://github.com/random-access-storage/random-access-chrome-file
- Issues: https://github.com/random-access-storage/random-access-chrome-file/issues
- npm.io page: https://npm.io/package/random-access-chrome-file

## Dependencies (1)

- [random-access-storage](https://npm.io/package/random-access-storage.md) ^1.3.0

## Recent versions

- 1.2.0 (latest) — 2021-11-24
- 1.1.4 — 2020-04-19
- 1.1.3 — 2019-03-15
- 1.1.2 — 2018-11-04
- 1.1.1 — 2018-08-23
- 1.1.0 — 2018-08-23
- 1.0.2 — 2018-08-23
- 1.0.1 — 2018-08-23
- 1.0.0 — 2018-08-22

## README

# random-access-chrome-file

A [random-access-storage](https://github.com/random-access-storage/random-access-storage) instance backed by the Chrome file system api

```
npm install random-access-chrome-file
```

## Usage

``` js
// Currently only works in Chrome

const createFile = require('random-access-chrome-file')

const file = createFile('test.txt')

file.write(0, Buffer.from('hello world'), function (err) {
  if (err) throw err
  file.read(0, 11, function (err, buf) {
    if (err) throw err
    console.log(buf.toString())
  })
})
```

## API

#### `file = createFile(name, [options])`

Returns a [random-access-storage](https://github.com/random-access-storage/random-access-storage) instance that supports
the full API.

Options include:

```js
{
  maxSize: Number.MAX_SAFE_INTEGER
}
```

`maxSize` is the storage quota it asks the browser for. If you are making an extension you can set the `unlimitedStorage`
to get all the storage you want. Otherwise tweak the `maxSize` option to fit your needs.

If you want to change the `maxSize` default for all instances change `createFile.DEFAULT_MAX_SIZE`.

#### `createFile.requestQuota(maxSize, cb)`

Manually request the `maxSize` quota without creating af file.

## License

MIT

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