Node js filesystem like php filesystem package thephpleague/flysystem
Flysystem is a filesystem abstraction library for NodeJs. By providing a unified interface for many different filesystems you’re able to swap out filesystems without application wide rewrites.
Using Flysystem can eliminate vendor-lock in, reduce technical debt, and improve the testability of your code.
# install
yarn add @filesystem/core # or:npm install @filesystem/core --save
Adapters | Status | Description |
---|---|---|
@filesystem/ali-oss-adapter | doing | aliyun oss adapter, support nodejs or browser |
@filesystem/ftp-adapter | doing | nodejs ftp upload |
@filesystem/sftp-adapter | doing | sftp adapter |
@filesystem/webdav-adapter | doing | webdav adapter |
@filesystem/memory-adapter | doing | memory filesystem adapter |
@filesystem/nestjs | doing | NestJs Module |
To safely interact with the filesystem, always wrap the adapter in a Filesystem instance.
import { LocalFilesystemAdapter, Filesystem } from '@filesystem/core';
// SETUP
const adapter = new LocalFilesystemAdapter(rootPath);
const filesystem = Filesystem(adapter);
// USAGE
await filesystem.write($path, $contents);