Skip to content

Instantly share code, notes, and snippets.

@epeters3
Last active September 2, 2021 19:33
Show Gist options
  • Save epeters3/7b8afddc41e74e7cfa48fa605d12d213 to your computer and use it in GitHub Desktop.
Save epeters3/7b8afddc41e74e7cfa48fa605d12d213 to your computer and use it in GitHub Desktop.
Upload file using GCS singed URL in Typescript
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