Last updated:
0 purchases
galileo file security
file_security #
Middleware for securing file uploads.
Supports:
Max file sizes
Max # of uploaded files
Restrict to certain extensions
Restrict to certain content types
Virus scan uploaded files via VirusTotal*
Your file upload API's can also be protected with throttleRequests
from galileo_security.
*Note: See VirusTotal's TOS. They do not allow use of their public API in commercial products. However, you can pay to use their private API.
Usage #
import 'package:galileo_framework/galileo_framework.dart';
import 'package:galileo_file_security/galileo_file_security.dart';
import 'package:http/http.dart' as http;
Future configureServer(galileo app) async {
var middleware = restrictFileUploads(
maxFiles: 3,
maxFileSize: 2000,
allowedExtensions: ['.jpg', '.png', '.gif'],
allowedContentTypes: ['image/jpeg', 'image/png', 'image/gif'],
);
var virusScanner = new VirusTotalScanner(
'<your-api-key>',
new http.Client(),
);
app
.chain([middleware, virusScanner.handleRequest])
.post('/api/upload', (req, res) {
// Secure...
});
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.