npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@revolt-digital/gallery-picker-s3

v0.0.5

Published

A package to handle backend side of gallery picker integrated with AWS S3.

Downloads

6

Readme

:email: revoltMailer

A package to handle backend side of gallery picker integrated with AWS S3.

Todo

  • [] Tests

Usage

  • Install the package
  npm install @revolt-digital/galley-picker-s3
  # or
  yarn add @revolt-digital/galley-picker-s3
  • Step 1, create one handler file, where we can define the aws config file, Note: Define this transport in server.ts/app.ts (main expressjs file) to use it globally is not a good practice.
import { S3Service } from '@revolt-digital/galley-picker-s3';

const serviceS3 = new S3Service({
  accessKey: process.env.AWACCESKEYID,
  secretAccessKey: process.env.AWSECRETACCESSKEY,
  region: process.env.AWREGION,
  signatureVersion: process.env.AWSIGNATURE,
  bucket: process.env.AWS3BUCKET
});
  • Step 2, get AWS Upload Signed URL`.
app.post('/uploadurl', async (req:Request, res: Response)=> {
  try {
    let options = {
      fileName: "imagename_withoutextension",
      extension: "jpg",
      width: 500,
      height: 500,
      aspectRatio: '1/1',
      item: 0 //item 0 is considerated as the original item
    }
    const url = await serviceS3.getS3UploadSigned(options);
    res.send(`success: ${url}`)
  } catch (err) {
    throw err;
  }
})
  • Step 3, Delete Image in s3`.
app.post('/delete', async (req:Request, res: Response)=> {
  try {
    const url = await serviceS3.deleteObject(req.body.fileName)
    res.send(`success: ${url}`)
  } catch (err) {
    console.log(err);
  }
})
  • Step 4, List All objects with pagination`.
app.get('/list', async (req:Request, res: Response)=> {
  try {
    const page = 1;
    const limit = 500;
    const data = await serviceS3.getObjects(page, limit)
    res.send({sucess: true, data: data})
  } catch (err) {
    throw err;
  }
})

Running the example app

Run yarn install then yarn build in the root folder (the one with this README file).

Then move into the example folder cd example and run yarn install and yarn start.

Then go to http://localhost:8001/uploadurl