vamtiger-get-file-data
v0.0.8
Published
Get data for a defined file path.
Downloads
33
Maintainers
Readme
VAMTIGER Get File Data
VAMTIGER Get File Data returns data associated for a defined file path.
Installation
VAMTIGER Get File Data can be installed using npm or yarn:
npm i vamtiger-get-file-data
or
yarn add vamtiger-get-file-data
Usage
Import or require a referece to VAMTIGER Get File Data:
import getFileData from 'vamtiger-get-file-data';
or
const getFileData = require('vamtiger-get-file-data').default;
VAMTIGER Get File Data will return data for defined file path as a buffer:
const fileData = getFileData('some/file/absolute/path')
.then(handleResult)
.catch(handleError);
When defining the encoding as utf-8, data will be returned as a string:
const fileText = getFileData('some/file/absolute/path', 'utf-8')
.then(handleResult)
.catch(handleError);
Since VAMTIGER Get File Data returns a Promise, it can be more conveniently executed within an async function:
async someAsyncFunction function() {
const fileData = await getFileData('some/file/absolute/path');
}