# random-access-open

> Open a file for random access read / write and create the file if it doesn't exist

Latest version **1.1.0** (published 2016-01-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install random-access-open
pnpm add random-access-open
yarn add random-access-open
bun add random-access-open
```

## 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.1.0 |
| Published | 2016-01-23 |
| First published | 2016-01-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Mathias Buus |
| Maintainers | mafintosh, ralphtheninja |

## Links

- npm: https://www.npmjs.com/package/random-access-open
- Repository: https://github.com/mafintosh/random-access-open
- Issues: https://github.com/mafintosh/random-access-open/issues
- npm.io page: https://npm.io/package/random-access-open

## Recent versions

- 1.1.0 (latest) — 2016-01-23
- 1.0.1 — 2016-01-19
- 1.0.0 — 2016-01-19

## README

# random-access-open

Open a file for random access read / write and create the file if it doesn't exist

```
npm install random-access-open
```

[![build status](http://img.shields.io/travis/mafintosh/random-access-open.svg?style=flat)](http://travis-ci.org/mafintosh/random-access-open)

## Usage

``` js
var open = require('random-access-open')
var fs = require('fs')

open('hello.txt', function (err, fd) {
  fs.write(fd, new Buffer('hello'), 0, 5, 0, function () {
    fs.write(fd, new Buffer('world'), 0, 5, 0, function () {
      fs.close(fd, function () {
        // prints "world"
        console.log(fs.readFileSync('hello.txt', 'utf-8'))
      })
    })
  })
})
```

## API

#### `open(filename, callback)`

Open a file for random access read / writes. Callback is called with `(err, fd)`

#### `var fd = open.sync(filename)`

Same as above but sync

## License

MIT

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