
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@bubojs/uploader
Advanced tools
This module is available through the npm registry
with npm
npm i @bubojs/uploader
or yarn
yarn add @bubojs/uploader
It is recommanded to use this module with @bubojs/api with this documentation for a quick start
Configure the config file :
import { S3 } from '@aws-sdk/client-s3';
import { S3Uploader } from '@bubojs/uploader';
export const s3Bucket = new S3({
endpoint: process.env.S3_ENDPOINT,
credentials: {
accessKeyId: process.env.S3_ACCESS_KEY_ID,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
},
region: process.env.S3_REGION,
});
export const uploader = new S3Uploader({
bucket: s3Bucket,
bucketName: process.env.S3_BUCKET_NAME,
folderName: process.env.S3_FOLDER_NAME,
});
Then use the object uploader functions as a middleware of your routes :
import { uploader } from './config'
import { Controller, BeforeMiddleware, Post } from '@bubojs/api'
@Controller()
class TestController {
/**
* upload route with form-data body
* Body: {
* file: đź“„
* }
*/
@BeforeMiddleware(
uploader.buildUploadEndpoint({ authorizedExtensions: ['jpeg', 'png']})
)
@Post('/')
async uploadRoute() {
console.log('uploaded files')
return {}
}
/**
* download route
* Params: {
* key: 'filename.jpeg'
* }
*/
@Get(':key', { bodyFormat: BodyFormat.AUTO, rawHandler: true })
downloadRoute() {
return uploader.buildDownloadEndpoint({
retrieveKeyCallback: async (req: any) => {
return req.params.key;
},
});
}
/**
* download route
* Params: {
* key: 'filename.jpeg'
* }
*/
@Delete(':key', { rawHandler: true })
deleteRoute() {
return uploader.buildDeleteEndpoint({
retrieveKeyCallback: async (req: any) => {
return req.params.key;
},
});
}
Create middleware to upload file online
Options:
Create middleware to download file online, file is send with Readable.pipe function on response object
Options:
Create middleware to delete file online
Options:
FAQs
## Install
We found that @bubojs/uploader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.