19

Working on applications in PHP, I like to use a file storage abstraction layer (for instance Flysystem). This makes it trivial to switch between locations where files should be persisted to (cloud storage, local drive, ZIP, whatever).

Currently I am getting started in Node.js so I was wondering if a similar module exists for node?

Searching the NPM site gave me a ton of hits related to the filesystem but nothing in regards to this level of abstraction.

Pier-Luc Gendreau
  • 13,553
  • 4
  • 58
  • 69
Potherca
  • 13,207
  • 5
  • 76
  • 94

3 Answers3

9

pkgcloud integrates multiple services (compute, storage, database. etc) and supports multiple cloud providers. The storage service's API is simple to use and supports streams, making it memory efficient as well.

Unfortunately, the project is longer maintained.

Pier-Luc Gendreau
  • 13,553
  • 4
  • 58
  • 69
  • Does this also support local file system? Would be nice to abstract local from AWS. – lostintranslation Dec 30 '15 at 16:36
  • It does not. However, I have made [cloudcp](https://www.npmjs.com/package/cloudcp) which uses pkgcloud under the hood and supports copying local files to the cloud. – Pier-Luc Gendreau Dec 30 '15 at 17:47
  • 6
    Yes, it supports local file system through package `filesystem-storage-pkgcloud`. Add and then enable it in your code `var pkgcloud = require('pkgcloud'); pkgcloud.providers.filesystem = {}; pkgcloud.providers.filesystem.storage = require('filesystem-storage-pkgcloud');`. – happy_marmoset Jan 04 '16 at 11:57
  • FYI pkgcloud only abstracts those providers that the web service owner typically pays for and fully controls (e.g. AWS S3). It does not support any storage providers that your users are responsible for (e.g. Google Drive.) – Malvineous Sep 15 '17 at 23:12
7

There is filefog, which is intended to support Google Drive, Dropbox, SkyDrive and Box, as well as the local filesystem. Like passport it uses ‘strategies’ published as separate modules for each provider (filefog-dropbox, filefog-onedrive, etc.).

  • Looks exactly like what I mean. I like the fact it uses the "promise" design pattern. Thanks! – Potherca Jun 24 '14 at 07:42
  • 4
    I am _very_ curious why this answer gets downvoted without the downvoters stating what their problem with this answer is... – Potherca Mar 04 '16 at 10:12
7

Flydrive

https://github.com/Slynova-Org/node-flydrive

  • Local
  • Amazon S3
  • Digital Ocean Spaces
  • FTP
Roman Rhrn Nesterov
  • 3,538
  • 1
  • 28
  • 16
  • Unfortunately, the project is longer maintained as a stand-alone package. It has been integrated in the AdonisJS Framework. – Alex Nov 08 '22 at 15:27