Skip to content

Instantly share code, notes, and snippets.

@pavelpower
Created September 27, 2016 14:02
Show Gist options
  • Save pavelpower/ff710e0a27405dad179902d66468c401 to your computer and use it in GitHub Desktop.
Save pavelpower/ff710e0a27405dad179902d66468c401 to your computer and use it in GitHub Desktop.
```
export default async function uploadFile(file, onProgressHandler) {
const fileData = {
parentFileId: '',
name: file.name,
tags: [],
description: file.name,
contentLength: file.size
};
const registerResponse = await this::putFile(fileData);
const fileId = registerResponse.id;
await this::uploadFileToBucket(file, registerResponse, onProgressHandler);
await this::putUploadedState(fileId);
return await getImageData(registerResponse);
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment