Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub


npm npm

Maintainability Contributor Covenant

Cache directories in your gatsby project to a remote server to preserve files and speed up deployments via https://github.com/axe312ger/sftp-cache

Works well with https://github.com/axe312ger/gatsby-plugin-netlify-cache, make sure to enable the netlify-cache plugin before the sftp-cache plugin.


  • Download from cache directory and refill it again
  • Compare file by missing on other end, modification date, file size and md5 hash
  • Keeps file modification date
  • Client: Windows, Linux, OSX
  • Server: Any host supporting sftp. MD5 hash comparision also needs md5 or md5sum installed on the server.


npm i gatsby-plugin-sftp-cache


Pass your server connection credentials, the remote cache directory and the directories you want to cache to the plugin options in your gatsby-config.js:

const { join } = require('path')

  path: `.env.${process.env.NODE_ENV}`

module.exports = {
  plugins: [
      resolve: `gatsby-plugin-sftp-cache`,
      options: {
        connection: {
          // All options: https://github.com/mscdex/ssh2#client-methods
          host: 'your.host.io',
          username: 'your-sft-user',
          password: process.env.SFTP_CACHE_PW
        remoteDir: '/home/your-sftp-user/sftp-cache-storage/assets',
        dirsToCache: [
          // Relative to your gatsby root directory
          join('public', 'assets'),
          join('node_modules', '.cache', 'gatsby-transformer-video')
        concurrency: 5 // Optional, defaults to 2.
© 2023 Gatsby, Inc.