Skip to content

Instantly share code, notes, and snippets.

View xeniaqian94's full-sized avatar
🎯
Focusing

Xin Qian xeniaqian94

🎯
Focusing
View GitHub Profile
@binki
binki / post-file.js
Last active October 4, 2023 14:35
posting a file loaded through fs.readFile() through axios+form-data
#!/usr/bin/env node
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
const filePath = __dirname + '/../accept-http-post-file/cookie.jpg';
fs.readFile(filePath, (err, imageData) => {
if (err) {
throw err;
}