Here what i am doing ,I am getting the file path from
var url = JSON.stringify(req.body.path);
which giving me the correct path but when i am using the passing the url
inside the below chunk of code
fs.createReadStream(url).
pipe(bucket.openUploadStream('test.apk')).
on('error', function(error) {
assert.ifError(error);
}).
on('finish', function() {
console.log('done!');
res.send("Uploaded Sucessfully..")
process.exit(0);
});
};
I am getting below error
Error: ENOENT: no such file or directory, open 'E:\\SomeServer\\"..\\apks\\testappV1.0.0.apk"'
at Error (native)
but if i am hard coding
var url1 = '../apks/testappV1.0.0.apk';
the url1
is working perfdect with the above code why url
not working i think i am doing some silly mistake not able to find , Can you please point out what i am doing wrong here.
No need to stringify the path.No JSON.stringify. req.body.path is already a string.
var url = req.body.path;
fs.createReadStream(url).
pipe(bucket.openUploadStream('test.apk')).
on('error', function(error) {
assert.ifError(error);
}).
on('finish', function() {
console.log('done!');
res.send("Uploaded Sucessfully..")
process.exit(0);
});
};
Hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.