Installations
npm install ng-file-manager-express
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=8.9
Node Version
8.10.0
NPM Version
5.2.0
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (98.13%)
JavaScript (1.87%)
Developer
funkizer
Download Statistics
Total Downloads
2,194
Last Day
1
Last Week
9
Last Month
31
Last Year
397
GitHub Statistics
2 Stars
22 Commits
1 Forks
1 Watching
1 Branches
1 Contributors
Package Meta Information
Latest Version
0.1.6
Package Id
ng-file-manager-express@0.1.6
Unpacked Size
114.55 kB
Size
28.39 kB
File Count
81
NPM Version
5.2.0
Node Version
8.10.0
Total Downloads
Cumulative downloads
Total Downloads
2,194
Last day
0%
1
Compared to previous day
Last week
350%
9
Compared to previous week
Last month
342.9%
31
Compared to previous month
Last year
51%
397
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
21
ng-filemanager-express
Express app/middleware for ng-file-manager
What it is
- An out-of-the-box Express backend for ng-file-manager (an Angular File Manager)
- Easily swappable connectors
- Filesystem: NgfmFileConnector (implemented)
- Creates thumbnails and previews automatically from images
- Popular cloud services (todo)
- Make your own? Easy. Publish it on NPM? <3
- Filesystem: NgfmFileConnector (implemented)
- Simple and easy-to-secure REST api
- Plays nice with other Express middleware and any Express-based framework that allows the use of your own middleware, eg. Loopback, NestJS, ...
- A pet project by a full-time full-stack dev, done on nights and weekends. Got so much from the Angular&Node communities, figured it's my time to give back.
- Github: ng-file-manager-express
Demo
- ng-file-manager
- Doesn't actually use any backend, uses the built-in memory connector, nothing persisted.
What it's not
- A complete framework. You'll need to implement at least some form of user authentication to keep things safe & sane.
TODO
- More examples, documentation & demos
Contact & questions
Give me a shout at Gitter:
Work in progress
Testing is mid-way and although unlikely, some breaking changes might come. Likely this however will only affect you if you decide to make your own connector. REST API will not see breaking changes.
REST API
- GET
/path/to/middleware/folder
- List files and folders
- GET
/path/to/middleware/folder/x.jpg
- Serve static file (default, can be disabled)
- POST
/path/to/middleware/folder/x.jpg
- Upload
x.jpg
tofolder
- FormData needs to have the file in the key
file
- Upload
- HEAD
/path/to/middleware/folder/x.jpg
- HEAD
/path/to/middleware/folder
- Get a unique, timestamped hash for the file or folder, presented in the header
ngfm-hash
- Get a unique, timestamped hash for the file or folder, presented in the header
- POST
/path/to/middleware/folder/x2.jpg?from=fileHash_abc123
- POST
/path/to/middleware/folder2?from=folderHash_abc123
- Move the file or folder associated to a hash acquired from HEAD into the path of this POST request.
- You have a few minutes to do this after retrieving the hash via HEAD, before the hash expires.
- This way of moving/renaming makes it very simple to secure moving files from one folder to another. All your guards need to ever only look at the request URL.
Usage
Examples are in TS. For JS, basically you should only need to remove types and replace
import { X } from 'ng-file-manager-express;
with -->
const { X } = require('ng-file-manager-express');
dev-app.ts
import express from 'express'
import * as path from 'path';
import { NgfmFileConnector } from 'ngfm-file-manager-express';
import { NgfmExpress } from 'ngfm-file-manager-express';
class DevApp {
public express
constructor() {
this.express = express()
this.mountRoutes()
}
private mountRoutes(): void {
const router = express.Router()
router.get('/', (req, res) => { res.json({ message: 'Hello World!' }) });
this.express.use('/', router);
/**
* Create a root for private user files.
*/
const commonRoot = path.join(__dirname, 'dev-files');
const privateRoot = path.join(commonRoot, 'private');
const privateConnector = new NgfmFileConnector({
root: privateRoot,
createRoot: true
});
/**
* Only an authenticated user with the correct userId can access/modify.
* This is where your own Auth middleware would need to step in and check the user.
*/
this.express.use('/files/private/:userId', (req, res, next) => {
if (req.params.userId !== '1337') {
return res.status(401).send('Unauthorized');
}
next();
});
this.express.use('/files/private', new NgfmExpress(privateConnector, {
serveStatic: privateRoot
}).router);
/**
* Create a public root
*/
const publicRoot = path.join(commonRoot, 'public');
const publicConnector = new NgfmFileConnector({
root: publicRoot,
createRoot: true
});
this.express.use('/files/public', new NgfmExpress(publicConnector, {
serveStatic: publicRoot
}).router);
}
}
export default new DevApp().express
index.ts
import app from './dev-app'
const port = process.env.PORT || 3000
app.listen(port, (err) => {
if (err) {
return console.log(err);
}
return console.log(`server is listening on ${port}`);
})
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/22 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
101 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25
- Warn: Project is vulnerable to: GHSA-8w4h-3cm3-2pm2
- Warn: Project is vulnerable to: GHSA-rvg8-pwq2-xj7q
- Warn: Project is vulnerable to: GHSA-pp7h-53gx-mx7r
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx
- Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-c6rq-rjc2-86v2
- Warn: Project is vulnerable to: GHSA-mh2h-6j8q-x246
- Warn: Project is vulnerable to: GHSA-5q88-cjfq-g2mh
- Warn: Project is vulnerable to: GHSA-xp63-6vf5-xf3v
- Warn: Project is vulnerable to: GHSA-257v-vj4p-3w2h
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-hr2v-3952-633q
- Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2
- Warn: Project is vulnerable to: GHSA-8mmm-9v2q-x3f9
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6
- Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9
- Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f
- Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p
- Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv
- Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8
- Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65
- Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq
- Warn: Project is vulnerable to: GHSA-vfrc-7r7c-w9mx
- Warn: Project is vulnerable to: GHSA-7wwv-vh3v-89cq
- Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm
- Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-pc5p-h8pf-mvwp
- Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37
- Warn: Project is vulnerable to: GHSA-p9w8-2mpq-49h9
- Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546
- Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp
- Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695
- Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm
- Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574
- Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-h726-x36v-rx45
- Warn: Project is vulnerable to: GHSA-xf5p-87ch-gxw2
- Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj
- Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf
- Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-fhjf-83wg-r2j9
- Warn: Project is vulnerable to: GHSA-gwg9-rgvj-4h5j
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-6g33-f262-xjp4
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp
- Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr
- Warn: Project is vulnerable to: GHSA-gp95-ppv5-3jc5
- Warn: Project is vulnerable to: GHSA-54xq-cgqr-rpm3
- Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7
- Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6
- Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj
- Warn: Project is vulnerable to: GHSA-wpg7-2c88-r8xv
- Warn: Project is vulnerable to: GHSA-7xcx-6wjh-7xp2
- Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7
- Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m
- Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9
- Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw
- Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc
- Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh
- Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-x2mc-8fgj-3wmr
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v
- Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
1.7
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More