
Security News
AI Agent Lands PRs in Major OSS Projects, Targets Maintainers via Cold Outreach
An AI agent is merging PRs into major OSS projects and cold-emailing maintainers to drum up more work.
gatsby-source-remote-file
Advanced tools
gatsby-source-remote-file is a simple wrapper around createRemoteFileNode() from gatsby-source-filesystem
Use it to add any URL as a file node in Gatsby, then optionally use a transformer plugin to turn the contents of the URL into other node(s).
npm install gatsby-source-remote-file --save
or
yarn add gatsby-source-remote-file
Add the plugin to your gatsby-config.js:
module.exports = {
plugins: [
// ... you likely have other plugins here
{
resolve: "gatsby-source-remote-file",
options: {
url: "https://jsonplaceholder.typicode.com/todos",
name: "todos",
},
},
// ... you likely have other plugins here as well
],
};
module.exports = {
plugins: [
{
resolve: "gatsby-source-remote-file",
options: {
// The source url of the remote file
url: "https://jsonplaceholder.typicode.com/todos",
// OPTIONAL
// Provide a name for the created node (default: "remote")
name: "todos",
// OPTIONAL
// The id of the parent node (i.e. the node to which the new remote File node will be linked to.
parentNodeId: "yadi-yadi-yadi",
// OPTIONAL
// Adds htaccess authentication to the download request if passed in.
auth: { htaccess_user: `USER`, htaccess_pass: `PASSWORD` },
// OPTIONAL
// Adds extra http headers to download request if passed in.
httpHeaders: { Authorization: `Bearer someAccessToken` },
// OPTIONAL
// Sets the file extension
ext: ".json",
// OPTIONAL
// If something goes wrong while downloading the remote file,
// report a warning instead of stopping the build. (default: "fail")
errorHandling: "warn",
},
},
],
};
You can transform the node created by this plugin with the onCreateNode API.
Continuing the TODO example, add the following to gatsby-node.js to create a node for each todo:
exports.onCreateNode = async ({
node,
loadNodeContent,
actions: { createNode },
createNodeId,
createContentDigest,
}) => {
if (node.name !== "todos") return; // 'todos' is the name we gave the remote node in gatsby-config.js, so we only want to transform that
try {
const nodeContent = await loadNodeContent(node);
const todos = JSON.parse(nodeContent);
todos.forEach((todo) => {
const childId = createNodeId(`${node.id}${todo.id}`);
const todoNode = {
...todo,
todoId: todo.id,
sourceInstanceName: node.name,
id: childId,
children: [],
parent: node.id,
internal: {
type: "Todo",
contentDigest: createContentDigest(todo),
description: "A todo to do for you, toodeloo",
},
};
createNode(todoNode);
});
} catch (error) {
console.error(error);
}
};
yarn test
Clone the repository and link it so that you can use it locally and test it in a Gatsby project:
git clone https://github.com/audunru/gatsby-source-remote-file.git
cd gatsby-source-remote-file
yarn install
yarn link
Create a new Gatsby project and link the local version of the plugin while you develop:
gatsby new gatsby-source-remote-file-test
cd gatsby-source-remote-file-test
yarn link "gatsby-source-remote-file"
yarn add gatsby-source-remote-file
You can now make changes in gatsby-source-remote-file, run yarn develop in the plugin directory and run yarn develop in your gatsby directory to test your changes.
FAQs
Fetch a remote file and use it as a node in Gatsby
We found that gatsby-source-remote-file demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
An AI agent is merging PRs into major OSS projects and cold-emailing maintainers to drum up more work.

Research
/Security News
Chrome extension CL Suite by @CLMasters neutralizes 2FA for Facebook and Meta Business accounts while exfiltrating Business Manager contact and analytics data.

Security News
After Matplotlib rejected an AI-written PR, the agent fired back with a blog post, igniting debate over AI contributions and maintainer burden.