Package Exports
- write
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (write) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
write

Write files to disk, creating intermediate directories if they don't exist.
Install
Install with npm:
$ npm install write --save
Usage
var writeFile = require('write');
API
writeFile
Asynchronously write a file to disk, creating any intermediate directories along the way if they don't already exist.
Params
dest
{String}: Destination file pathstr
{String}: String to write to disk.callback
{Function}
Example
var writeFile = require('write');
writeFile('foo.txt', 'This is content to write.', function(err) {
if (err) console.log(err);
});
.writeFile.sync
Synchronously write files to disk, creating any intermediate directories along the way if they don't already exist.
Params
dest
{String}: Destination file pathstr
{String}: String to write to disk.
Example
var writeFile = require('write');
writeFile.sync('foo.txt', 'This is content to write.');
.writeFile.stream
Uses fs.createWriteStream
, but also creates any intermediate directories along the way if they don't already exist.
Params
dest
{String}: Destination file pathreturns
{Stream}: Returns a write stream.
Example
var writeFile = require('write');
writeFile.stream('foo.txt');
Related projects
- delete: Delete files and folders and any intermediate directories if they exist (sync and async). | homepage
- read-data: Read JSON or YAML files. | homepage
- read-json: Reads and parses a JSON file. | homepage
- read-yaml: Very thin wrapper around js-yaml for directly reading in YAML files. | homepage
- write-json: Write a JSON file to disk, also creates intermediate directories in the destination path if… more | homepage
- write-yaml: Write YAML. Converts JSON to YAML writes it to the specified file. | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Building docs
Generate readme and API documentation with verb:
$ npm install verb && npm run docs
Or, if verb is installed globally:
$ verb
Running tests
Install dev dependencies:
$ npm install -d && npm test
Author
Jon Schlinkert
License
Copyright © 2016 Jon Schlinkert Released under the MIT license.
This file was generated by verb, v0.9.0, on March 09, 2016.