extensions/xnat/src/utils/IO/classes/AIMExporter.js
/**
   * _PUTAIM - PUTs an the AIMExporter's AIM file to XNAT.
   *
   * @param  {string} url The destination url.
   * @returns {Promise}   A promise that resolves on a successful PUT and
   * rejects otherwise.
   */
PUTs an the AIMExporter's AIM file to XNAT.
@param  {string} url The destination url.
@returns {Promise}   A promise that resolves on a successful PUT and
rejects otherwise.
PUTs an the AIMExporter ' s AIM file to XNAT . @param { string } url The destination url . @returns { Promise } A promise that resolves on a successful PUT and rejects otherwise .
_PUTAIM(url) {
    const arraybuffer = this._getArraybuffer();
    return new Promise((resolve, reject) => {
      const xhr = new XMLHttpRequest();
      xhr.onload = () => {
        console.log(`Request returned, status: ${xhr.status}`);
        if (xhr.status === 200 || xhr.status === 201) {
          resolve();
        } else {
          reject(xhr.responseText);
        }
      };
      xhr.onerror = () => {
        console.log(`Request returned, status: ${xhr.status}`);
        reject(xhr.responseText);
      };
      xhr.open('PUT', url);
      xhr.setRequestHeader('Content-Type', 'application/octet-stream');
      xhr.send(arraybuffer);
    });
  }
_PUTAIM ( url ) { const arraybuffer = this . _getArraybuffer ( ) ; return new Promise ( ( resolve , reject ) => { const xhr = new XMLHttpRequest ( ) ; xhr . onload = ( ) => { console . log ( ` ${ xhr . status } ` ) ; if ( xhr . status === 200 || xhr . status === 201 ) { resolve ( ) ; } else { reject ( xhr . responseText ) ; } } ; xhr . onerror = ( ) => { console . log ( ` ${ xhr . status } ` ) ; reject ( xhr . responseText ) ; } ; xhr . open ( 'PUT' , url ) ; xhr . setRequestHeader ( 'Content-Type' , 'application/octet-stream' ) ; xhr . send ( arraybuffer ) ; } ) ; }
_PUTAIM - PUTs an the AIMExporter's AIM file to XNAT.
_PUTAIM - PUTs an the AIMExporter ' s AIM file to XNAT .