Skip to content

Instantly share code, notes, and snippets.

@krzkaczor
Created December 28, 2016 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krzkaczor/bdbe09d4096b051a3c18387c4ca79a06 to your computer and use it in GitHub Desktop.
Save krzkaczor/bdbe09d4096b051a3c18387c4ca79a06 to your computer and use it in GitHub Desktop.
const users = [
{
your: "json"
}
]
var Readable = require('stream').Readable
var s = new Readable()
s.push(JSON.stringify(users))
s.push(null)
s.path = 'data.json'
const rp = require('request-promise')
rp({
method: 'POST',
uri: 'URL',
formData: {
some: 'DATA',
file: s
}
}).then(res => {
console.log(res)
}).catch(err => {
console.error(err)
})
@bibiboot
Copy link

screen shot 2016-12-28 at 1 00 18 pm

I get this error i am using this snippet with react js client code. Any ideas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment