
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
loopback-component-flatstorage
Advanced tools
loopback component for attaching to various cloud storage providers with ACL functionality
loopback component for attaching to various cloud storage providers with ACL and relations functionality
LoopBack flatstorage component provides Node.js and REST APIs to manage binary file contents using pluggable storage providers, such as local file systems, Amazon S3, or Rackspace cloud files. It uses pkgcloud to support cloud-based storage services.
The module is only tested on amazon but potentially can work on all cloud providers - use at own risk! or better yet - contribute!
This module is based entirely on loopback-component-storage
The differences are:
| Description | REST URI |
|---|---|
| List all files | GET /api/mystorage |
| List all files in a specified folder | GET /api/mystorage/myfolder |
| Get information for specified file within a specified folder | GET /api/mystorage/myfolder/files/myfile |
| Delete a specified file within a specified folder | DELETE /api/mystorage/myfolder/files/myfile |
| Download a specified file within a specified folder | GET /api/mystorage/myfolder/download/myfile |
| Upload one or more files into a specified container. The request body must use multipart/form-data which is the file input type HTML uses | POST /api/mystorage/myfolder/files/upload |
To create a model for images storage per user:
datasource.json:
{
"ImagesS3": {
"name": "ImagesS3",
"provider": "amazon",
"connector": "loopback-component-flatstorage",
"container": "user-images",
"region": "eu-central-1",
"key": "<key>",
"keyId": "<key-id>"
}
}
images.json:
{
"name": "Images",
"plural": "Images",
"base": "PersistedModel",
"idInjection": false,
"properties": {
"userId": {
"type": "string",
"required": true,
"id": true,
"generated": false
}
},
"validations": [],
"relations": {
"user": {
"type": "belongsTo",
"model": "User",
"foreignKey": "userId",
"required": true
}
},
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY"
},
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$owner",
"permission": "ALLOW"
}
],
"methods": {}
}
user.json:
...
"relations": {
"images": {
"type": "hasOne",
"model": "Images",
"foreignKey": "userId"
}
}
...
The model can be used in nested queries.
To continue our example, we can enable the following nested rest api for a user to give him control over his files:
To configure:
app.models.User && app.models.Images && app.models.User.nestRemoting('images', {
filterMethod: function (method, relation) {
var matches = method.name.indexOf('removeFile') > -1 || method.name.indexOf('file') > -1 || method.name.indexOf('download') > -1 || method.name.indexOf('upload') > -1;
if (matches) {
return '__' + method.name + '__' + relation.name;
}
}
});
FAQs
loopback component for attaching to various cloud storage providers with ACL functionality
We found that loopback-component-flatstorage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.