Flystorage is a Filesystem Equivalent Package for Node.js

Flysystem developer Frank de Jonge created Flystorage, a single API to integrate with many storage solutions for Node.js, written in Typescript.

<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

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 files
await 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 directories
await 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.


The post Flystorage is a Filesystem Equivalent Package for Node.js appeared first on Laravel News.

Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.

Read more

© 2024 Extly, CB - All rights reserved.