Skip to content

Instantly share code, notes, and snippets.

@SSARCandy
Last active November 15, 2017 08:53
Show Gist options
  • Save SSARCandy/fc3f5a08ff35f10ad96b24d8ffcffce4 to your computer and use it in GitHub Desktop.
Save SSARCandy/fc3f5a08ff35f10ad96b24d8ffcffce4 to your computer and use it in GitHub Desktop.
auto upload to phancer and get the result
const fs = require('fs');
const request = require('request-promise');
const option = {
method: 'POST',
uri: 'http://phancer.com/upload?net=iphone_6',
formData: {
file: {
value: fs.createReadStream('image_.jpg'),
options: {
filename: 'image_.jpg',
contentType: 'image/jpg'
}
}
},
};
request(option)
.then((res) => {
console.log(res);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment