npm

Need private packages and team management tools?Check out npm Orgs. »

open-file

1.0.0 • Public • Published

open-file

NPM version Build Status Coverage Status dependencies Status devDependencies Status

A Node module to open a file with resolving its file descriptor

const openFile = require('open-file');
 
openFile('file.txt', 'r').then(fileDescriptor => {
  fileDescriptor; //=> 15
});

Installation

Use npm.

npm install open-file

API

openFile = require('open-file');

openFile(filePath, flags [, mode])

filePath: String (a file path to open)
flags: String or Number
mode: Integer
Return: Promise of the file descriptor (Integer)

Almost the same function as fs.open, except:

  • The first argument is restricted to String and doesn't accept Buffer by design.
  • It returns a promise instead of calling a callback function.

License

Copyright (c) 2016 - 2017 Shinnosuke Watanabe

Licensed under the MIT License.

install

npm i open-file

Downloadsweekly downloads

16

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability