src/entity/File.js
/**
 * Upload file data, previously obtained from disk or the user.
 *
 * Note: Only text or encoded text is currently supported here.
 *
 * @param {*} data - Data as buffer or string.
 */
Upload file data, previously obtained from disk or the user.
Note: Only text or encoded text is currently supported here.

@param {*} data - Data as buffer or string.
Upload file data previously obtained from disk or the user . Note : Only text or encoded text is currently supported here . @param { * } data - Data as buffer or string .
async function upload (data) {
  const resource = await this.read()
  const opts = {
    method: 'put',
    headers: {
      'Content-Type': resource.type,
      'x-amz-acl': resource.privateAccess ? 'private' : 'public-read'
    },
    body: data
  }
  return fetch(resource.uploadUrl, opts)
}
async function upload ( data ) { const resource = await this . read ( ) const opts = { method : 'put' , headers : { 'Content-Type' : resource . type , 'x-amz-acl' : resource . privateAccess ? 'private' : 'public-read' } , body : data } return fetch ( resource . uploadUrl , opts ) }
Upload file data, previously obtained from disk or the user.
Upload file data previously obtained from disk or the user .