node.js - JavaScript/Node + cURL -
i have line of curl:
curl -x post --form "file=@calvin harris - thinking (tez cadey remix)_165299184_soundcloud.mp3" https://api.idolondemand.com/1/api/async/recognizespeech/v1
i'm building hybrid mobile app meteor/ionic framework. therefore, have access node library leverages curl.
can anyone:
1) suggest 1 of many node-curl libraries 2) show me how output above curl line in context of right library?
my primary issue stopping me --form
flag. i've poured on several libraries/docs , none explicitly reference how use form flag. cannot drop flag, it's requirement of api.
you use node's fs , https apis
var fs = require('fs'); var https = require('https'); var rs = fs.createreadstream( 'calvin harris - thinking (tez cadey remix)_165299184_soundcloud.mp3' ); var req = http.request({ hostname: 'api.idolondemand.com', path: '/1/api/async/recognizespeech/v1', method: 'post' }, function(res) { // when response }); rs.pipe(req);
or use requests module @ffk mentioned
Comments
Post a Comment