Skip to content

Instantly share code, notes, and snippets.

@nelsondev19
Created April 23, 2023 04:18
Show Gist options
  • Save nelsondev19/a0c30a9f3193e6a1c1da1acb2708ba2a to your computer and use it in GitHub Desktop.
Save nelsondev19/a0c30a9f3193e6a1c1da1acb2708ba2a to your computer and use it in GitHub Desktop.
import axios from 'axios';
import fs from 'fs';
const url = '<your-pre-signed-url>';
const filePath = '<path-to-your-mp4-file>';
const fileStream = fs.createReadStream(filePath);
axios.put(url, fileStream, {
headers: {
'Content-Type': 'video/mp4'
}
}).then(({ status }) => {
console.log(`File uploaded successfully with status ${status}!`);
}).catch((error) => {
console.error('Error uploading file:', error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment