loopback-component-storage-gridfs
Uses mongoDB GridFS to manage binary contents of your loopback application.
Inspired by
- https://github.com/strongloop/loopback-component-storage
- https://github.com/jdrouet/loopback-component-storage-mongo
Behaviors
- Files are identified by id, not by file name. So it is possible to have files of the same name in one container.
Installation
npm install --save loopback-component-storage-gridfs
Datasource
Add datasource to your datasources.json
"storage":
username and password are optional
API
List containers
GET /FileContainers
FileContainer;
Delete container
DELETE /FileContainers/:containerName
FileContainer;
- containerName - name of container to delete
List files in container
GET /FileContainers/:containerName/files
FileContainer;
- containerName - name of container
Errors:
- 404 File not found.
Get file information
GET /FileContainers/:containerName/files/:fileId
FileContainer;
- containerName - name of container
- fileId - id of file
Delete file
DELETE /FileContainers/:containerName/files/:fileId
FileContainer;
- containerName - name of container
- fileId - id of file to delete
Upload files
POST /FileContainers/:containerName/upload
- containerName - name of container
Download file
GET /FileContainers/:containerName/download/:fileId
- containerName - name of container
- fileId - id of file to download
Errors:
- 404 File not found.
Download container as zip file
GET /FileContainers/:containerName/zip
- containerName - name of container
Errors:
- 404 No files to archive.