node-red-viseo-storage-plugin/index.js
function writeFile(path,content) {
    return when.promise(function(resolve,reject) {
        var stream = fs.createWriteStream(path);
        stream.on('open',function(fd) {
            stream.end(content,'utf8',function() {
                fs.fsync(fd,resolve);
            });
        });
        stream.on('error',function(err) {
            reject(err);
        });
    });
}
function writeFile(path,content) {
    return when.promise(function(resolve,reject) {
        var stream = fs.createWriteStream(path);
        stream.on('open',function(fd) {
            stream.end(content,'utf8',function() {
                fs.fsync(fd,resolve);
            });
        });
        stream.on('error',function(err) {
            reject(err);
        });
    });
}
function writeFile ( path , content ) { return when . promise ( function ( resolve , reject ) { var stream = fs . createWriteStream ( path ) ; stream . on ( 'open' , function ( fd ) { stream . end ( content , 'utf8' , function ( ) { fs . fsync ( fd , resolve ) ; } ) ; } ) ; stream . on ( 'error' , function ( err ) { reject ( err ) ; } ) ; } ) ; }
Write content to a file using UTF8 encoding.
This forces a fsync before completing to ensure
the write hits disk.
Write content to a file using UTF8 encoding . This forces a fsync before completing to ensure the write hits disk .