环回下载文件
Loopback Download file
我正在按照文档下载文件。
https://docs.strongloop.com/display/public/LB/Storage+component
在该文档中,如果下载文件意味着需要遵循 url 模式。
GET /containers/{container}/files/{file}
示例:
我有 container1(容器名称)和文件名 lb.png。
所以我把url变成了这样
http://localhost:3000/api/containers/container1/files/lb.png?access_token=8Hfay0LRU2g22BjCqf3q8HsQCdsVBgBp9MHeekr3LfNLlILVUzUHUsUKOZmjTRD9
我正在收到文件名的回复,
我希望一旦我在浏览器中使用 url 意味着文件应该下载到 url.
获得的响应:
{
"container": "container1",
"name": "lb.png",
"size": 38780,
"atime": "2016-03-18T05:13:41.000Z",
"mtime": "2016-03-18T05:09:06.000Z",
"ctime": "2016-03-18T05:09:06.000Z"
}
预期输出:
我需要下载文件(lb.png)。
不,文档说:
Get information for specified file within specified container.
getFile(container, file, cb)
GET /api/containers/:container/files/:file
您需要使用这条路线:
Download a file within specified container.
download(container, file, res, cb)
GET /api/containers/:container/download/:file
我正在按照文档下载文件。
https://docs.strongloop.com/display/public/LB/Storage+component
在该文档中,如果下载文件意味着需要遵循 url 模式。
GET /containers/{container}/files/{file}
示例:
我有 container1(容器名称)和文件名 lb.png。
所以我把url变成了这样
http://localhost:3000/api/containers/container1/files/lb.png?access_token=8Hfay0LRU2g22BjCqf3q8HsQCdsVBgBp9MHeekr3LfNLlILVUzUHUsUKOZmjTRD9
我正在收到文件名的回复, 我希望一旦我在浏览器中使用 url 意味着文件应该下载到 url.
获得的响应:
{
"container": "container1",
"name": "lb.png",
"size": 38780,
"atime": "2016-03-18T05:13:41.000Z",
"mtime": "2016-03-18T05:09:06.000Z",
"ctime": "2016-03-18T05:09:06.000Z"
}
预期输出:
我需要下载文件(lb.png)。
不,文档说:
Get information for specified file within specified container.
getFile(container, file, cb)
GET /api/containers/:container/files/:file
您需要使用这条路线:
Download a file within specified container.
download(container, file, res, cb)
GET /api/containers/:container/download/:file