🚀 Launch Week Day 4:Introducing the Alert Details Page: A Better Way to Explore Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

@k6-contrib/fields-s3-images

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@k6-contrib/fields-s3-images

Keystone6 S3 Sharp Optimized Image Field Type

latest
Source
npmnpm
Version
7.2.0
Version published
Maintainers
1
Created
Source

S3 Sharp Image Optimized Field

import { S3ImagesConfig, s3Images } from '@k6-contrib/fields-s3-images';
import 'dotenv/config';

const s3sConfig: S3sConfig = {
  bucketName: process.env.S3_BUCKET, // name of bucket
  pathPrefix: process.env.S3_PATH,
  accessKeyId: process.env.S3_ACCESS_KEY_ID,
  secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
  endpoint: process.env.S3_ENDPOINT, // use region for aws, endpoint for s3 compatible storage
  region: process.env.S3_REGION!,
  acl: 'public-read',
  signed: { expiry: 3600 }, // in seconds to generate pre signed urls.
  preserve: true, // do not delete the old image automatically
  sizes: {
    sm: 360,
    md: 720,
    lg: 1280,

    // optional
    // if specified, a base64 data url will be generated from an image resized to this number of pixels
    // see: https://nextjs.org/docs/api-reference/next/image#blurdataurl for potential uses
    base64: 200,
  },
  // optional - use it to use a meaningful name to uploads
  transformName: url => url,
};

const Post = list({
  fields: {
    title: text({ validation: { isRequired: true } }),
    content: text(),
    image: s3Image({ s3Config }),
    file: s3File({ s3Config }),
  },
});
query {
  images {
    image {
      id
      width
      height

      # defaults to size: md
      url

      lgUrl: url(size: lg)

      # base64 data url (if enabled via config, otherwise `null`)
      placeholderUrl: url(size: base64)

      # img html element compatible srcset
      srcSet(sizes: [sm, md, lg])
    }
  }
}

FAQs

Package last updated on 06 Sep 2025

Did you know?

Socket

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.

Install

Related posts