lib/file.js
function(options) {
      options= options || {};

      var self = this;
      if (!self._previousSave) {
        self._previousSave = self._source.then(function(base64, type) {
          var data = {
            base64: base64,
            _ContentType: type
          };
          return Parse._request({
            route: "files",
            className: self._name,
            method: 'POST',
            data: data,
            useMasterKey: options.useMasterKey
          });

        }).then(function(response) {
          self._name = response.name;
          self._url = response.url;
          return self;
        });
      }
      return self._previousSave._thenRunCallbacks(options);
    }
function(options) {
      options= options || {};

      var self = this;
      if (!self._previousSave) {
        self._previousSave = self._source.then(function(base64, type) {
          var data = {
            base64: base64,
            _ContentType: type
          };
          return Parse._request({
            route: "files",
            className: self._name,
            method: 'POST',
            data: data,
            useMasterKey: options.useMasterKey
          });

        }).then(function(response) {
          self._name = response.name;
          self._url = response.url;
          return self;
        });
      }
      return self._previousSave._thenRunCallbacks(options);
    }
function ( options ) { options = options || { } ; var self = this ; if ( ! self . _previousSave ) { self . _previousSave = self . _source . then ( function ( base64 , type ) { var data = { base64 : base64 , _ContentType : type } ; return Parse . _request ( { route : "files" , className : self . _name , method : 'POST' , data : data , useMasterKey : options . useMasterKey } ) ; } ) . then ( function ( response ) { self . _name = response . name ; self . _url = response . url ; return self ; } ) ; } return self . _previousSave . _thenRunCallbacks ( options ) ; }
Saves the file to the Parse cloud.
@param {Object} options A Backbone-style options object.
@return {Parse.Promise} Promise that is resolved when the save finishes.
Saves the file to the Parse cloud .