Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

vamtiger-get-file-data

0.0.8 • Public • Published

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');
}

Install

npm i vamtiger-get-file-data

DownloadsWeekly Downloads

11

Version

0.0.8

License

MIT

Unpacked Size

6.86 kB

Total Files

12

Last publish

Collaborators

  • avatar