Skip to content

zen-fs/cloud

Repository files navigation

ZenFS Cloud

Warning

This package was implemented very recently and may not be stable.

If you find a bug, please report it. Thanks!

This package adds backends for many cloud providers to ZenFS, including:

  • Dropbox
  • Amazon Web Services' S3
  • Google Drive (planned)

For more information, see the API documentation.

Important

Please read the ZenFS core documentation!

Installing

npm install @zenfs/cloud

Note

Examples are written using ESM.

Dropbox

import { configure, fs } from '@zenfs/core';
import { Dropbox } from '@zenfs/cloud';
import { Dropbox as DropboxClient } from 'dropbox';

const client = new DropboxClient({
	accessToken: '...',
	// ...
});

await configure({
	mounts: {
		'/mnt/dropbox': {
			backend: Dropbox,
			client,
		},
	},
});

S3

Caution

This backend is still in the process of being developed and is not stable.

import { configure, fs } from '@zenfs/core';
import { S3Bucket } from '@zenfs/cloud';
import { S3 } from '@aws-sdk/client-s3';

const client = new S3({
	// ...
});

await configure({
	mounts: {
		'/mnt/s3': {
			backend: S3Bucket,
			bucketName: 'your-bucket',
			client,
		},
	},
});