Flystorage is a Filesystem Equivalent Package for Node.js
Last updated on by Paul Redmond
Flysystem developer Frank de Jonge created Flystorage, a single API to integrate with many storage solutions for Node.js, written in Typescript.
Want to use #flysystem, but your boss forces you to write your apps in #nodejs, or god forbid... #typescript? You're in luck!
— Frank de Jonge (@frankdejonge) January 2, 2024
Because I do not adequately value my free time, you can now use https://t.co/9j9iHelhtX for all your file storage needs. Don't forget to like & subscribe
Like the PHP version, this package uses the adapter pattern to create a consistent API around managing files with Node.js, giving you the same API to upload files to S3, in-memory, or a local filesystem:
// Manage filesawait storage.write('path/to/file.txt', contents, options);const exists = await storage.fileExists('path/to/file.txt');const contents = await storage.read('path/to/file.txt');await storage.deleteFile('path/to/file.txt');await storage.copyFile('from/here.txt', 'to/there.txt', { visibility: Visibility.PRIVATE,}); // Manage directoriesawait storage.createDirectory('path/to/directory');await storage.deleteDirectory('path/to/directory');await storage.directoryExists('path/to/directory'); // and more...
The full FileStorage API for this package is available in the documentation. With the initial release of this package, it supports the following adapters:
- Amazon S3
- Azure Storage Blob
- Google Cloud Storage
- In-Memory
- Local FS
If you need to support another adapter (i.e., FTP), this package is written in TypeScript, which provides the StorageAdapter
interface.
To get started with this package, check out the complete documentation on flystorage.dev.