lib/index.js
function writeFileP (outputPath, data, cb) {
    outputPath = abs(outputPath);
    let dirname = path.dirname(outputPath);
    mkdirp(dirname, err => {
        if (err) { return cb(err); }
        let str = data;
        if (typpy(data, Array) || typpy(data, Object)) {
            str = JSON.stringify(data, null, 2);
        }
        fs.writeFile(outputPath, str, err => cb(err, data));
    });
}
function writeFileP (outputPath, data, cb) {
    outputPath = abs(outputPath);
    let dirname = path.dirname(outputPath);
    mkdirp(dirname, err => {
        if (err) { return cb(err); }
        let str = data;
        if (typpy(data, Array) || typpy(data, Object)) {
            str = JSON.stringify(data, null, 2);
        }
        fs.writeFile(outputPath, str, err => cb(err, data));
    });
}
writeFileP
Create the directory structure and then create the file.

@name writeFileP
@function
@param {String} outputPath The path to the file you want to create.
@param {String|Object} data The file content. If an Array/Object is provided, it will be stringified.
@param {Function} cb The callback function.