# vinyl-readfile-promise

> Promise to create a vinyl file object from an actual file

Latest version **1.0.0** (published 2015-01-15) · 0 weekly downloads

## Install

```sh
npm install vinyl-readfile-promise
pnpm add vinyl-readfile-promise
yarn add vinyl-readfile-promise
bun add vinyl-readfile-promise
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-01-15 |
| First published | 2015-01-15 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Shinnosuke Watanabe |
| Maintainers | shinnn |
| Keywords | gulpfriendly, gulp, vinyl, file, read, promise, then, thenable |

## Links

- npm: https://www.npmjs.com/package/vinyl-readfile-promise
- Repository: https://github.com/shinnn/vinyl-readfile-promise
- Issues: https://github.com/shinnn/vinyl-readfile-promise/issues
- npm.io page: https://npm.io/package/vinyl-readfile-promise

## Dependencies (2)

- [vinyl-file](https://npm.io/package/vinyl-file.md) ^1.1.1
- [wrap-promise](https://npm.io/package/wrap-promise.md) ^1.0.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-01-15

## README

# vinyl-readfile-promise

[![NPM version](https://img.shields.io/npm/v/vinyl-readfile-promise.svg?style=flat)](https://www.npmjs.com/package/vinyl-readfile-promise)
[![Build Status](https://img.shields.io/travis/shinnn/vinyl-readfile-promise.svg?style=flat)](https://travis-ci.org/shinnn/vinyl-readfile-promise)
[![Build status](https://ci.appveyor.com/api/projects/status/exsbqpeixknb679w?svg=true)](https://ci.appveyor.com/project/ShinnosukeWatanabe/vinyl-readfile-promise)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/vinyl-readfile-promise.svg?style=flat)](https://coveralls.io/r/shinnn/vinyl-readfile-promise)
[![Dependency Status](https://img.shields.io/david/shinnn/vinyl-readfile-promise.svg?style=flat&label=deps)](https://david-dm.org/shinnn/vinyl-readfile-promise)
[![devDependency Status](https://img.shields.io/david/dev/shinnn/vinyl-readfile-promise.svg?style=flat&label=devDeps)](https://david-dm.org/shinnn/vinyl-readfile-promise#info=devDependencies)

[Promises/A+][Promise] version of [vinyl-file](https://github.com/sindresorhus/vinyl-file):

> Create a [vinyl file](https://github.com/wearefractal/vinyl) from an actual file

```javascript
var vinylReadFile = require('vinyl-readfile-promise');

vinylReadFile('index.js')
.then(function(file) {
  file.path; //=> /root/dir/index.js
  file.cwd; //=> /root/dir
})
.catch(), function(err) {
  throw err;
});
```

## Installation

[Use npm.](https://docs.npmjs.com/cli/install)

```
npm install vinyl-readfile-promise
```

## API

```javascript
var vinylReadFile = require('vinyl-readfile-promise');
```

### vinylReadFile(*filePath* [, *options*])

*filePath*: `String`  
*options*: `Object` (directly passed to [vinyl-file options](https://github.com/sindresorhus/vinyl-file#options))  
Return: `Object` ([Promise])

When it finish reading a file, it will be [*fulfilled*](http://promisesaplus.com/#point-26) with a [vinyl file object](https://github.com/wearefractal/vinyl#file) as an argument.

When it fails to read a file, it will be [*rejected*](http://promisesaplus.com/#point-30) with an error as an argument.

```javascript
var vinylReadFile = require('vinyl-readfile-promise');

function onFulFilled(file) {
  file.isNull(); //=> false
  file.isBuffer(); //=> false
  file.isBuffer(); //=> true
}

function onRejected(err) {
  throw err;
}

vinylReadFile('path/to/file', {buffer: false}).then(onFulFilled, onRejected);
```

## License

Copyright (c) [Shinnosuke Watanabe](https://github.com/shinnn)

Licensed under [the MIT License](./LICENSE).

[Promise]: https://promisesaplus.com/

---
_Source: https://npm.io/package/vinyl-readfile-promise · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
