Last active
September 2, 2021 19:33
-
-
Save epeters3/7b8afddc41e74e7cfa48fa605d12d213 to your computer and use it in GitHub Desktop.
Upload file using GCS singed URL in Typescript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from "axios"; | |
const uploadFile = async ( | |
file: File, | |
signedUrl: string | |
): Promise<void> => { | |
await axios.put(signedUrl.replace(/"/g, ""), file, { | |
headers: { | |
"Content-Type": "application/octet-stream", | |
"X-Goog-Content-Length-Range": "1,1000000" | |
}, | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment