Socket
Book a DemoInstallSign in
Socket

random-access-open

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

random-access-open

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

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
2
Created
Source

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

Usage

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

FAQs

Package last updated on 23 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts