How to use the pn/fs.writeFileSync function in pn

To help you get started, we’ve selected a few pn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jkphl / svg-sprite / test / svg-sprite.js View on Github external
function writeFile(file, content) {
    try {
        mkdirp.sync(path.dirname(file));
        fs.writeFileSync(file, content);
        return file;
    } catch (e) {
        return null;
    }
}
github jkphl / svg-sprite / test / svg-sprite.js View on Github external
function writeFiles(files) {
    var written = 0;
    for (var key in files) {
        if (_.isObject(files[key])) {
            if (files[key].constructor === File) {
                mkdirp.sync(path.dirname(files[key].path));
                fs.writeFileSync(files[key].path, files[key].contents);
                ++written;
            } else {
                written += writeFiles(files[key]);
            }
        }
    }
    return written;
}