Package Exports
- mantiqh-resizer-js
- mantiqh-resizer-js/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mantiqh-resizer-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Mantiqh Resizer JS
Developed by Mantiqh Technologies
Basic Details
- Used for uploading files to AWS S3.
- Files are resized according to user-defined dimensions.
- Package uses pnpm as the package manager.
Installation
npm i mantiqh-resizer-jsUsage
import { resizeAndUpload } from 'mantiqh-resizer-js'
// your backend code...
// File buffer received from multer
const fileBuffer = req.file.buffer
// Output key for storage location in S3
const outputKey = `uploads/${Date.now()}-${req.file.originalname}`
// Resize and upload to S3
const imageUrl = await resizeAndUpload(fileBuffer, 300, 300, outputKey)
console.log('Image URL:', imageUrl) // Returns a CloudFront URL
// your backend code...After execution, you will receive a URL from AWS CloudFront.
Requirements
Ensure you have the following AWS credentials set in a .env file:
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
S3_BUCKET=your-bucket-name
CLOUDFRONT_DOMAIN=your-cloudfront-domain