Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-source-gcs-image

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-source-gcs-image

GatsbyJS plugin to source images from Google Cloud Storage

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

gatsby-source-gcs-image

build status npm license test coverage test coverage

What is this?

gatsby-source-gcs-image is a GatsbyJS source plugin converting images from Google Cloud Storage into GatsbyJS File nodes--much like how this plugin works with AWS S3. See here for more.

The created GatsbyJS File nodes can then be manipulated with image processors like sharp.

Usage

Install

npm install --save-dev gatsby-source-gcs-image

or

yarn add -D gatsby-source-gcs-image

Configure

At a minimum GCP creds must be provided with either credsJson or pathToCreds. Some example configurations are:

// gatsby-config.js

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-gcs-image',
      options: {
        bucketName: 'my-gcs-bucket.appspot.com',
        bucketPath: '/path/to/images',
        expires: 120,
        pathToCreds: `${__dirname}/.gcp-creds.json`,
        projectId: 'my-gcp-project',
      },
    },
    // ...image transform plugins
  ],
}

or

// gatsby-config.js

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-gcs-image',
      options: {
        credsJson: process.env.ENV_VAR_WITH_CREDS,
      },
    },
    // ...image transform plugins
  ],
}
Fields
nametypedefaultrequireddescription
bucketNamestring*GCS bucket (may exist in creds)
credsJsonstring*JSON string with creds (optional if pathToCreds is provided)
expiresnumber900signed url expiration in seconds
pathToCredsstring*JSON file with creds (optional if credsJson is provided)
projectIdstring*GCP project id (may exist in creds)

Query data

export const pageQuery = graphql`
  {
    allGcsImage {
      edges {
        node {
          name
          childImageSharp {
            gatsbyImageData(layout: CONSTRAINED, width: 800)
          }
        }
      }
    }
  }
`

Keywords

FAQs

Package last updated on 09 Mar 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc