Zum Inhalt springen
Skillpedia
APIs & Server (Backend)25k · #10084

nocobase-drive

Was er macht

Dieser Skill konfiguriert die Dateispeicherung in einer NocoBase-3-App, für lokale Ordner, S3-kompatible Dienste und Aliyun OSS. Er ist für Entwickler, die Uploads und Speichereinstellungen verwalten.

Wann du ihn nutzt

  • ✓Wenn du ändern musst, wo eine NocoBase-App hochgeladene Dateien speichert.
  • ✓Wenn du eine App mit S3- oder Aliyun-OSS-Speicher verbinden möchtest.
  • ✓Wenn du korrigieren musst, wie Speicher-URLs oder Dateioperationen konfiguriert sind.

Link zum Skill

https://github.com/nocobase/nocobase/blob/v3-develop/packages/libs/drive/skills/nocobase-drive/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/nocobase/nocobase/blob/v3-develop/packages/libs/drive/skills/nocobase-drive/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Kannst du meine NocoBase-App so einrichten, dass hochgeladene Dateien in einem S3-Bucket statt auf der lokalen Festplatte gespeichert werden?”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Die KI bearbeitet die Speicherkonfiguration und wählt den passenden Treiber für den Speichertyp. Danach prüft sie die Dateioperationen und die URLs, die die App erzeugt.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

File storage with NocoBase Drive

Use @nocobase/drive for storage operations. It wraps Flydrive with application configuration and a native Aliyun OSS driver. Choose the relevant reference before changing a disk:

Storage Driver Read
A local or mounted filesystem fs Filesystem configuration, paths, and URLs
Amazon S3 or an S3-compatible service s3 S3 configuration, credentials, and ACLs
Native Aliyun OSS with access keys or an ECS RAM role oss OSS configuration, credentials, and networking
An application-owned or third-party Flydrive driver Factory function Custom driver factories

Configuration and application integration

Configure default and disks in server/config/drive.ts; config.yml can override serializable object options. A disk name is the key in disks, while driver selects an implementation. For example, local: { driver: 'fs', ... } is selected by drive.use('local'). default must name an entry in disks. Objects and synchronous factories can coexist; no separate services configuration or driver registry is required.

Keep the application's existing DriveProvider and import driveManagerToken from @nocobase/app-server/drive. In server code that already has an application instance:

import { driveManagerToken } from '@nocobase/app-server/drive';

const drive = app.container.resolve(driveManagerToken);
const disk = drive.use();

await disk.put('reports/example.txt', 'Example report');
const contents = await disk.get('reports/example.txt');

Use drive.use(name) to select another disk. Pass storage keys relative to that disk, such as reports/example.txt; do not pass an absolute filesystem path, a URL, or a pre-encoded key. The manager creates disks on first use and caches successful creation. Resolve the shared manager instead of constructing one per request.

File Repository selects these same disks by name. Use the installed File plugin for file records, Repository upload/download operations, and their permissions. Direct Drive operations do not create File Repository records or perform its authorization checks. Changing the default disk does not move stored objects or rewrite existing records.

Boundaries and verification

visibility does not itself guarantee HTTP access or isolation. Filesystem serving and object storage policies determine actual access; generating a public URL does not grant permission to a private object. Read the selected driver's URL behavior before exposing a link.

Release artifact storage needs serializable configuration. Custom factories are rejected when selected by releases.artifact.disk. Named artifact references currently accept private fs and s3 objects; use the complete OSS object directly under releases.artifact or host.artifact for OSS, as the OSS guide describes.

For standalone use, call prepareDriveStorage(config) before createDriveManager(config) when filesystem directory preparation is needed. The application Provider already performs preparation. Tests can supply createDriveManager(config, { fakes: { location } }) and use Flydrive's fake()/restore(); fakes verify application behavior without proving remote credentials, ACLs, or network access.

Verify a configuration change with a write, read or streamed download, and deletion under a disposable key. Check public or signed links from the intended client's network when the feature uses them. Report whether verification used local storage, fakes, or the real remote service. For custom drivers, also verify lazy creation and repeated use through the shared manager.

Häufige Fragen

Deckt das Upload-Berechtigungen ab?

Nein. Dateisammlungen und Upload-Rechte gehören zum File-Plugin.

Kann ich einen Speichertyp verwenden, der nicht aufgeführt ist?

Ja. Der Skill behandelt eigene Treiber-Factories für andere Speicherdienste.

Deckt er Speicher-Zugangsdaten ab?

Ja. Er erklärt, wie Zugangsdaten für jeden Speichertyp eingerichtet werden.

Details

Originalbeschreibung des Autors

Configure and use file storage with @nocobase/drive in NocoBase 3 applications, including local filesystem, S3-compatible storage, native Aliyun OSS, and custom driver factories. Use when changing drive configuration, storage credentials, file operations, or storage URLs. File Repository collections and upload permissions belong to the File plugin.

repo: nocobase/nocobase

Beliebtheit

GitHub-Sterne
25k
Platz im Ranking
#10084
Lizenz
—
Aktualisiert
2.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills