.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / write / README.md
1 # write [![NPM version](https://badge.fury.io/js/write.svg)](http://badge.fury.io/js/write)  [![Build Status](https://travis-ci.org/jonschlinkert/write.svg)](https://travis-ci.org/jonschlinkert/write)
2
3 > Write files to disk, creating intermediate directories if they don't exist.
4
5 Install with [npm](https://www.npmjs.com/)
6
7 ```sh
8 $ npm i write --save
9 ```
10
11 ## API docs
12
13 ### [writeFile](index.js#L32)
14
15 Asynchronously write a file to disk. Creates any intermediate directories if they don't already exist.
16
17 **Params**
18
19 * `dest` **{String}**: Destination file path
20 * `str` **{String}**: String to write to disk.
21 * `callback` **{Function}**
22
23 **Example**
24
25 ```js
26 var writeFile = require('write');
27 writeFile('foo.txt', 'This is content to write.', function(err) {
28   if (err) console.log(err);
29 });
30 ```
31
32 ### [.writeFile.sync](index.js#L64)
33
34 Synchronously write files to disk. Creates any intermediate directories if they don't already exist.
35
36 **Params**
37
38 * `dest` **{String}**: Destination file path
39 * `str` **{String}**: String to write to disk.
40
41 **Example**
42
43 ```js
44 var writeFile = require('write');
45 writeFile.sync('foo.txt', 'This is content to write.');
46 ```
47
48 ### [.writeFile.stream](index.js#L87)
49
50 Uses `fs.createWriteStream`, but also creates any intermediate directories if they don't already exist.
51
52 **Params**
53
54 * `dest` **{String}**: Destination file path
55 * `returns` **{Stream}**: Returns a write stream.
56
57 **Example**
58
59 ```js
60 var write = require('write');
61 write.stream('foo.txt');
62 ```
63
64 ## Related
65
66 * [delete](https://github.com/jonschlinkert/delete): Delete files and folders and any intermediate directories if they exist (sync and async).
67 * [read-yaml](https://github.com/jonschlinkert/read-yaml): Very thin wrapper around js-yaml for directly reading in YAML files.
68 * [read-json](https://github.com/azer/read-json): Reads and parses a JSON file.
69 * [read-data](https://github.com/jonschlinkert/read-data): Read JSON or YAML files.
70 * [write-yaml](https://github.com/jonschlinkert/write-yaml): Write YAML. Converts JSON to YAML writes it to the specified file.
71 * [write-json](https://github.com/jonschlinkert/write-json): Write a JSON to file disk, also creates directories in the dest path if they… [more](https://github.com/jonschlinkert/write-json)
72
73 ## Running tests
74
75 Install dev dependencies:
76
77 ```sh
78 $ npm i -d && npm test
79 ```
80
81 ## Contributing
82
83 Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/write/issues/new)
84
85 ## Author
86
87 **Jon Schlinkert**
88
89 + [github/jonschlinkert](https://github.com/jonschlinkert)
90 + [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
91
92 ## License
93
94 Copyright © 2015 Jon Schlinkert
95 Released under the MIT license.
96
97 ***
98
99 _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 29, 2015._
100
101 <!-- deps:mocha -->