Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gatsby-source-s3): download non-image files #225

Open
NelisDrost opened this issue Jun 14, 2022 · 4 comments
Open

feat(gatsby-source-s3): download non-image files #225

NelisDrost opened this issue Jun 14, 2022 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@NelisDrost
Copy link

NelisDrost commented Jun 14, 2022

I'd like to be able to retrieve files other than images from S3, and access them through GraphQL.

Currently, localfile nodes are only generated in GraphQL for image files, and not e.g.: mdx, json or other data/text files.

I'm specifically interested in mdx files (which I assume could then be ingested by gatsby-transformer-mdx).

Is there a design reason for only creating local file nodes for images? If there are drawbacks to handling all files, a config option for other file extensions to accept seems like a clean solution, e.g.:
{ resolve: 'gatsby-source-s3', options: { aws: { ... }, buckets: [...], file_extensions: ['.mdx', '.json'], },

@NelisDrost NelisDrost added the enhancement New feature or request label Jun 14, 2022
@moonmeister
Copy link
Contributor

@robinmetral may know the answer. If there's no particular reason I'd be happy to accept a PR.

@sebhewelt
Copy link

I was trying to understand why it doesn't process my markdown files. I believe gatsby-source-s3-images would be a more accurate name for this source plugin, rather than gatsby-source-s3 😅 Looking forward to that enhancement 👍👏

@moonmeister
Copy link
Contributor

@sebhewelt You interested in contributing such an enhancement?

@robinmetral
Copy link

Hey folks, I'm super sorry for the extremely late reply here, I had ignored notifications on this repo for some reason 🙈

This was previously requested for .md files but never implemented. Here's the ref on the archived repo: gatsby-uc/gatsby-source-s3#505 (comment)

tl;dr there is no specific design reason weighing against this. The only challenge is that the plugin was built specifically to download image files for processing by sharp, not for any other purpose—so I'm not sure what exactly needs to change beyond removing this isImage check:

if (node.internal.type === "S3Object" && node.Key && isImage(node.Key)) {

For example it's possible that the schema needs to be different, depending on what you'd like to do with your files. This would probably require some fiddling/testing but can probably be done 🙂

I unfortunately don't have any time to implement this (and I haven't worked with Gatsby for some time, so would probably not be the best person to do it). But consider this a green light for a contribution 🟢

jbolda pushed a commit that referenced this issue Jan 28, 2023
@moonmeister moonmeister added the help wanted Extra attention is needed label Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants