vamtiger-get-file-data
Get data for a defined file path.
Last updated 2 years ago by vamtiger-project .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install vamtiger-get-file-data 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.0.8                                ...           latest (2 years ago)

3 Versions

  • 0.0.8                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 6
Dependencies (1)
Dev Dependencies (8)

Copyright 2014 - 2017 © taobao.org |