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

simple-web-image

v2.0.0

Published

A simple library to process the image in many sizes for the website.

Downloads

2

Readme

npm version code style: prettier

simple-web-image

A simple library to process the image to many sizes for the website.

Features

  • Optimize the image size and quality of the website.
  • Resize images to different sizes to use for desktop and mobile. It works better for the lazy load.
  • Store the output locally or in the cloud storage (ext: s3, minio, ...).

Prerequisites

This project requires NodeJS (version 14 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.

$ npm -v && node -v
6.4.1
v14.15.0

Getting Started

npm install simple-web-image

Basic usage:


import SimpleWebImage from 'simple-web-image'

const config = {
    drives: {
        local: { rootDir: './tmp/output/simple-web-image' },
        s3: {
            accessKeyId: "THE AWS ACCESS KEY ID",
            secretAccessKey: "THE AWS SECRET ACCESS KEY",
            bucket: "simple-web-image",
            region: "us-east-1"
        }
    }
}

const simple = new SimpleWebImage(config)

try {
    await simple.drive('local').put(req, './tmp/output/simple-web-image/image-name')
    await simple.drive('s3').put(req, './tmp/output/simple-web-image/image-name')
} catch (error) {
    // code here
}

Using with expressjs:


import express from "express"
import SimpleWebImage from "simple-web-image"
const app = express()
const port = 3000

const config = {}

const simple = new SimpleWebImage(config)

// should upload with binary body
app.post("/upload", async (req, res) => {
  try {
    await simple.drive('local').put(req, './tmp/output/simple-web-image/image-name')
    res.send("upload success")
  } catch (err) {
    res.send("upload fail")
  }
});

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
})

Look at the example repo for more details.

Contributing

Any contributions from the community are welcome.

Find a bug, a typo, or something that’s not documented well? We’d love for you to open an issue telling us what we can improve! Follow the CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

We love your pull requests! Check out our Good First Issue and Help Wanted tags for good issues to tackle. Check out our contributors guide for more information.

If you like what you see, star us on GitHub

Roadmap

See the ROADMAP.md file

License

MIT License © Vu Lai