mantiqh-resizer-js
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

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-js

Usage

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

Dependents (0)

Package Sidebar

Install

npm i mantiqh-resizer-js

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

9.51 kB

Total Files

10

Last publish

Collaborators

  • zaki-mantiqh