# fs-writefile-promise

> Promise version of fs.writefile

Latest version **3.0.2** (published 2019-02-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install fs-writefile-promise
pnpm add fs-writefile-promise
yarn add fs-writefile-promise
bun add fs-writefile-promise
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2019-02-18 |
| First published | 2015-06-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 0 |
| Unpacked size | 4.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Ahmad Nassri |
| Maintainers | ahmadnassri |
| Keywords | node, fs, writefile, promise |

## Links

- npm: https://www.npmjs.com/package/fs-writefile-promise
- Repository: https://github.com/ahmadnassri/node-fs-writefile-promise
- Issues: https://github.com/ahmadnassri/node-fs-writefile-promise/issues
- npm.io page: https://npm.io/package/fs-writefile-promise

## 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

- 3.0.2 (latest) — 2019-02-18
- 3.0.1 — 2018-11-06
- 3.0.0 — 2018-03-18
- 2.0.0 — 2016-11-19
- 1.0.3 — 2015-08-18
- 1.0.2 — 2015-08-18
- 1.0.1 — 2015-06-21
- 1.0.0 — 2015-06-21

## README

# fs.writeFile Promise

[![License][license-image]][license-url] [![version][npm-image]][npm-url] [![Build Status][circle-image]][circle-url]

> [Promise][] version of [fs.writeFile][]:  
> Asynchronously writes data to a file, replacing the file if it already exists.

## Install

```bash
npm install fs-writefile-promise
```

## API

<!-- lint disable no-shortcut-reference-link -->
### write(filename, data [, options])
<!-- lint enable no-shortcut-reference-link -->

- _filename_: `String`
- _data_ `String` or `Buffer`
- _options_: `Object`

Return: `Object` ([Promise][])

When it finishes, it will be [_fulfilled_](http://promisesaplus.com/#point-26) with the file name that was written to.

When it fails, it will be [_rejected_](http://promisesaplus.com/#point-30) with an error as its first argument.

```js
write('/tmp/foo', 'bar')
  .then(filename => console.log(filename)) //=> '/tmp/foo'
  .catch(err => console.error(err))
```

#### options

The option object will be directly passed to [fs.writeFile][].

---
> Author: [Ahmad Nassri](https://www.ahmadnassri.com/) &bull; 
> Github: [@ahmadnassri](https://github.com/ahmadnassri) &bull; 
> Twitter: [@AhmadNassri](https://twitter.com/AhmadNassri)

[license-url]: LICENSE
[license-image]: https://img.shields.io/github/license/ahmadnassri/node-fs-writefile-promise.svg?style=for-the-badge&logo=circleci

[circle-url]: https://circleci.com/gh/ahmadnassri/workflows/node-fs-writefile-promise
[circle-image]: https://img.shields.io/circleci/project/github/ahmadnassri/node-fs-writefile-promise/master.svg?style=for-the-badge&logo=circleci

[npm-url]: https://www.npmjs.com/package/fs-writefile-promise
[npm-image]: https://img.shields.io/npm/v/fs-writefile-promise.svg?style=for-the-badge&logo=npm

[fs.writefile]: https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback
[promise]: http://promisesaplus.com/

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