1.0.0 • Published 9 years ago
open-file v1.0.0
open-file
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
npm install open-fileAPI
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
Stringand doesn't acceptBufferby design. - It returns a promise instead of calling a callback function.
License
Copyright (c) 2016 - 2017 Shinnosuke Watanabe
Licensed under the MIT License.