lib/account/upload-skin.js
function uploadSkin ({accessToken}, profileId, file, isSlim = false) {
  const form = new FormData()
  form.append('model', isSlim ? 'slim' : '')
  form.append('file', file)

  return fetch(`${CORE_API}/user/profile/${profileId}/skin`, {
    method: 'PUT',
    body: form,
    headers: {
      'user-agent': USER_AGENT,
      'authorization': `Bearer ${accessToken}`
    }
  })
    .then(handleErrors)
    .then(res => null)
}
function uploadSkin ({accessToken}, profileId, file, isSlim = false) {
  const form = new FormData()
  form.append('model', isSlim ? 'slim' : '')
  form.append('file', file)

  return fetch(`${CORE_API}/user/profile/${profileId}/skin`, {
    method: 'PUT',
    body: form,
    headers: {
      'user-agent': USER_AGENT,
      'authorization': `Bearer ${accessToken}`
    }
  })
    .then(handleErrors)
    .then(res => null)
}
function uploadSkin ( { accessToken } , profileId , file , isSlim = false ) { const form = new FormData ( ) form . append ( 'model' , isSlim ? 'slim' : '' ) form . append ( 'file' , file ) return fetch ( ` ${ CORE_API } ${ profileId } ` , { method : 'PUT' , body : form , headers : { 'user-agent' : USER_AGENT , 'authorization' : ` ${ accessToken } ` } } ) . then ( handleErrors ) . then ( res => null ) }
Uploads a file as a logged-in user's in-game skin.

@param {Object} session - object from authentication
@param {string} session.accessToken - valid access token for the user's account
@param {string} profileId - which profile UUID to update the skin of
@param {Stream|Buffer} file - new skin's binary image data
@param {boolean} [isSlim] - if true, the slim model will be used with the skin
@returns {Promise} resolves if access token, profile UUID, and stream are valid
@see {@link http://wiki.vg/Mojang_API#Change_Skin}
Uploads a file as a logged - in user s in - game skin .