source/index.js
function(/* filename, data[, encoding], callback */) {
            var args = Array.prototype.slice.call(arguments),
                argc = args.length;
            if (argc <= 2) {
                throw new Error("Invalid number of arguments");
            }
            var filePath = args[0],
                data = args[1],
                encoding = (argc >= 3 && typeof args[2] === "string") ? args[2] : "text",
                callback = function() {};
            if (typeof args[2] === "function") {
                callback = args[2];
            } else if (argc >= 4 && typeof args[3] === "function") {
                callback = args[3];
            }
            encoding = (encoding === "utf8") ? "text" : encoding;
            client
                .putFileContents(filePath, data, { format: encoding })
                .then(function() {
                    __executeCallbackAsync(callback, [null]);
                })
                .catch(callback);
        }
function(/* filename, data[, encoding], callback */) {
            var args = Array.prototype.slice.call(arguments),
                argc = args.length;
            if (argc <= 2) {
                throw new Error("Invalid number of arguments");
            }
            var filePath = args[0],
                data = args[1],
                encoding = (argc >= 3 && typeof args[2] === "string") ? args[2] : "text",
                callback = function() {};
            if (typeof args[2] === "function") {
                callback = args[2];
            } else if (argc >= 4 && typeof args[3] === "function") {
                callback = args[3];
            }
            encoding = (encoding === "utf8") ? "text" : encoding;
            client
                .putFileContents(filePath, data, { format: encoding })
                .then(function() {
                    __executeCallbackAsync(callback, [null]);
                })
                .catch(callback);
        }
function ( /* filename, data[, encoding], callback */ ) { var args = Array . prototype . slice . call ( arguments ) , argc = args . length ; if ( argc <= 2 ) { throw new Error ( "Invalid number of arguments" ) ; } var filePath = args [ 0 ] , data = args [ 1 ] , encoding = ( argc >= 3 && typeof args [ 2 ] === "string" ) ? args [ 2 ] : "text" , callback = function ( ) { } ; if ( typeof args [ 2 ] === "function" ) { callback = args [ 2 ] ; } else if ( argc >= 4 && typeof args [ 3 ] === "function" ) { callback = args [ 3 ] ; } encoding = ( encoding === "utf8" ) ? "text" : encoding ; client . putFileContents ( filePath , data , { format : encoding } ) . then ( function ( ) { __executeCallbackAsync ( callback , [ null ] ) ; } ) . catch ( callback ) ; }
Write data to a remote file
@param {String} filename The remote file path to write to
@param {Buffer|String} data The data to write
@param {String=} encoding Optional encoding to write as (utf8/binary) (default: utf8)
@param {Function} callback Callback: function(error)
Write data to a remote file