This repo is modification from https://github.com/MrMartiniMo/loopback-component-storage-gridfs
Uses mongoDB GridFS to manage binary contents of your loopback application.
- https://github.com/strongloop/loopback-component-storage
- https://github.com/jdrouet/loopback-component-storage-mongo
- https://github.com/MrMartiniMo/loopback-component-storage-gridfs
- Files are identified by id, not by file name. So it is possible to have files of the same name in one container.
- Added HTTP Range feature
- Added Bandwidth Limit feature via datasource options
npm install --save loopback-component-storage-gridfs-httprange
Add datasource to your datasources.json
"storage": {
"name": "gridfs",
"connector": "loopback-component-storage-gridfs-httprange",
"host": "hostname",
"port": 27017,
"database": "database",
"username": "username",
"password": "password",
"limit" : 320000
}
username and password are optional
- name : Datasource name
- connector : loopback-component-storage-gridfs-httprange
- host : MongoDB Hostname
- port : MongoDB Port
- database : MongoDB database name
- username : MongoDB username
- password : MongoDB password
- limit : Bandwidth limit when downloading file, in bit
GET /FileContainers
FileContainer.getContainers();
DELETE /FileContainers/:containerName
FileContainer.deleteContainer({
containerName: 'containerName',
fileId: 'fileId'
});
- containerName - name of container to delete
GET /FileContainers/:containerName/files
FileContainer.getFiles({
containerName: 'containerName'
});
- containerName - name of container
GET /FileContainers/:containerName/files/:fileId
FileContainer.getFile({
containerName: 'containerName',
fileId: 'fileId'
});
- containerName - name of container
- fileId - id of file
DELETE /FileContainers/:containerName/files/:fileId
FileContainer.deleteFile({
containerName: 'containerName',
fileId: 'fileId'
});
- containerName - name of container
- fileId - id of file to delete
POST /FileContainers/:containerName/upload
- containerName - name of container
GET /FileContainers/:containerName/download/:fileId
- containerName - name of container
- fileId - id of file to download