Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
township-media
Advanced tools
A Township plugin that adds routes and methods for managing media uploads. Includes support for Amazon S3.
var township = require('township')
var media = require('township-media')
var memdown = require('memdown')
var levelup = require('levelup')
var db = levelup('db', {db: memdown})
var options = {
uploadDir: __dirname + '/uploads',
allowedMimeTypes: ['png', 'jpeg', 'gif', 'mpeg', 'avi', 'ogg']
maxFileSize: 4000000
}
var server = township(db)
server.add(media(options))
server.listen()
maxFileSize
- The maximum allowed file size (in bytes). The default is 2000000
(2mb)allowedMimeTypes
- The allowed mime types for uploaded files. mime-types is used to verify mime types so the following is all valid: ['json', 'markdown', '.png', 'jpeg']
. Defaults to allowing all mime types.uploadDir
- The path to prepend to the files being saved. When using disk storage this will look like /assets/[uploadDir]/image.jpg
. When using S3 this will look like https://s3.amazonaws.com/[bucket]/[uploadDir]/image.jpg
. The default is uploads
.Required when using AWS S3:
accessKeyId
- Your AWS S3 access key id.secretAccessKey
- Your AWS S3 secret access key.bucket
- Your AWS S3 bucket name.MIT
FAQs
A plugin for Township that adds media upload capabilities
The npm package township-media receives a total of 1 weekly downloads. As such, township-media popularity was classified as not popular.
We found that township-media demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.