Socket
Book a DemoInstallSign in
Socket

payloadcms-ftp-storage

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

payloadcms-ftp-storage

FTP adapter for Payload CMS's plugin-cloud-storage plugin

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

PayloadCMS FTP Storage Adapter

FTP adapter for Payload CMS's plugin-cloud-storage plugin

This adapter uses basic-ftp to handle the FTP operations.

Usage

Let's say we have a Videos collection (which slug is "videos") and we want to store the uploads on a third-party remote storage using FTP.

At the top of your payload.config.ts file, add the following:

import { ftpAdapter } from "payloadcms-ftp-storage";

Then within the buildConfig add the following:

plugins: [
  cloudStorage({
    collections: {
      videos: {
          adapter: ftpAdapter({
            host: "ftp.domain.com",
            user: "ftpUser",
            password: "ftpUserPassword",
            secure: true,
            endpoint: "https://domain.com/videos",
        }),
        disableLocalStorage: true,
        disablePayloadAccessControl: true,
      },
    },
  }),
],

If we upload a video file name "my-video.mp4", the file will be uploaded at the home of "ftpUser" at "ftp.domain.com", in a subfolder named "videos" (because this is the slug of the collection) as a file with the same name as the original "my-video.mp4". In conclusion, the path of the transfered file will be ~/videos/my-video.mp4, and its public address will be https://domain.com/videos/my-video.mp4

Beware: when deleting an entry, the file will also be deleted on the remote storage. Also, if a file "my-video.mp4" already exists, and we try to upload another file with the same name, the original file will be overwritten.

FAQs

Package last updated on 05 Apr 2024

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.