【发布时间】:2018-08-01 17:20:58
【问题描述】:
我是角度方面的新手。我有一组图像,我想在加载页面时将其显示在客户端浏览器上。
有没有可能?
我现在可以发送单个文件,但不能发送多个文件,但我被卡住了,谁能帮帮我。
感谢您的帮助
router.get('/getList', function(req, res, next) {
var fileNames = [];
fileNames = readDir.readSync('/NodeWorkspace/uploads/output/', ['**.png']);
var data = {};
fileNames.forEach(function(filename) {
filepath = path.join(__dirname, '../../uploads/output') + '/' + filename;
fs.readFile(path.join(__dirname, '../../uploads/output') + '/' + filename, function(err, content) {
if (!err) {
console.log(content);
}
});
});
//res.sendFile(path.join(__dirname,'../../uploads/output/', fileNames[0]));
response.data = fileNames;
res.json(response);
});
【问题讨论】:
标签: node.js angular typescript