javascript - Unzip and Save uploaded Zip File using Node -
i'd appreciate figuring out how zip file unzip.
app.post("/api/upload/", upload.single("recfile"), function(req, res){ console.log("saving new zipped shapefile"); console.log(req.file); var tmp_path = tostring(req.file.path; var target_path = "test/" + req.file.originalname; var dest = fs.createwritestream(target_path); var src = fs.createreadstream(tmp_path); src.pipe(unzip.extract({path: dest})); // tojson.fromshpfile(dest).pipe(dest); });
the files upload , save test folder i'm created, receive error regarding unzip code.
error: enoent: no such file or directory, open '[object undefined]'
i think since code asynchronous, isn't recognizing uploaded file in directory time code runs. promise work in case?
Comments
Post a Comment