You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+8-7
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# write [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68)[](https://www.npmjs.com/package/write)[](https://npmjs.org/package/write)[](https://npmjs.org/package/write)[](https://travis-ci.org/jonschlinkert/write)
1
+
# write [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68)[](https://www.npmjs.com/package/write)[](https://npmjs.org/package/write)[](https://npmjs.org/package/write)[](https://travis-ci.org/jonschlinkert/write)
2
2
3
3
> Write data to a file, replacing the file if it already exists and creating any intermediate directories if they don't already exist. Thin wrapper around node's native fs methods.
Asynchronously writes data to a file, replacing the file if it already exists and creating any intermediate directories if they don't already exist. Data can be a string or a buffer. Returns a promise if a callback function is not passed.
67
67
@@ -71,6 +71,7 @@ Asynchronously writes data to a file, replacing the file if it already exists an
71
71
*`data`**{String|Buffer|Uint8Array}**: Data to write.
72
72
*`options`**{Object}**: Options to pass to [fs.writeFile](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback)
73
73
*`callback`**{Function}**: (optional) If no callback is provided, a promise is returned.
74
+
*`returns`**{Object}**: Returns an object with the `path` and `contents` of the file that was written to the file system. This is useful for debugging when `options.increment` is used and the path might have been modified.
The synchronous version of [write](#write). Returns undefined.
100
101
@@ -103,7 +104,7 @@ The synchronous version of [write](#write). Returns undefined.
103
104
*`filepath`**{String}**: file path.
104
105
*`data`**{String|Buffer|Uint8Array}**: Data to write.
105
106
*`options`**{Object}**: Options to pass to [fs.writeFileSync](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options)
106
-
*`returns`**{undefined}**
107
+
*`returns`**{Object}**: Returns an object with the `path` and `contents` of the file that was written to the file system. This is useful for debugging when `options.increment` is used and the path might have been modified.
Returns a new [WriteStream](https://nodejs.org/api/fs.html#fs_class_fs_writestream) object. Uses `fs.createWriteStream` to write data to a file, replacing the file if it already exists and creating any intermediate directories if they don't already exist. Data can be a string or a buffer.
118
119
@@ -186,7 +187,7 @@ You might also be interested in these projects:
0 commit comments