node.js - Nodejs upload a model to shapeways api -
node.js - Nodejs upload a model to shapeways api -
i trying upload obj file shapeways api. tried using request module creating url. doesn't seem working. show me code examples? documentation mentions php
thanks
fs.readfile("/models/temp.obj",function(err,data){ var params = {file:data, filename:"temp.obj", hasrightstomodel: 1, accepttermsandconditions: 1} var client = new shapeways.client({ consumerkey: config.app.key, consumersecret: config.app.secret, oauthtoken: req.session.oauthtoken, oauthsecret: req.session.oauthsecret, }); client.addmodel(params,callback); })
here's code. fs.readfile returns undefined.
looks code has 2 issues.
one don't specify root dir, uncertainty mean /models. , 2 should never ignore err parameter.
fs.readfile(__dirname + "/models/temp.obj", function (err, data) { if (err) { throw err; } // . . . });
node.js 3d webgl
Comments
Post a Comment