vamtiger-get-file-data

Get data for a defined file path.

Usage no npm install needed!

<script type="module">
  import vamtigerGetFileData from 'https://cdn.skypack.dev/vamtiger-get-file-data';
</script>

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