1.21.0 • Published 2 years ago
@jabrythehutt/fs-s3 v1.21.0
FS-S3
This project provides an abstraction layer that covers some common read and write operations relating to the Node file system and AWS S3.
It's currently a work in progress, you can use the old version until this is published.
Why
I found myself re-implementing the following procedures in various projects:
- Copy a local folder to S3
- Skip existing files
- Delete files in an S3 folder
This project aims to make it easier and safer to write your S3-based storage layer.
Usage
Web
import {S3FileService} from "@jabrythehutt/fs-s3";
import S3 from "aws-sdk/clients/s3";
const s3 = new S3();
const fileService = new S3FileService(s3);
async function deleteOldFiles() {
await fileService.delete({
key: "my/old-files",
bucket: "my-bucket"
});
}
Node
import {NodeFileService, LocalFileService} from "@jabrythehutt/fs-s3/lib/node";
import {S3FileService} from "@jabrythehutt/fs-s3";
import S3 from "aws-sdk/clients/s3";
const s3 = new S3();
const fileService = new NodeFileService(new LocalFileService(), new S3FileService(s3));
async function localToS3() {
const source = {
key: "/tmp/myfolder"
};
const destination = {
bucket: "my-bucket",
key: "foo/mynewfolder"
}
await fileService.copy({source, destination});
}
1.19.0
2 years ago
1.21.0
2 years ago
1.20.0
2 years ago
1.18.0
3 years ago
1.17.0
3 years ago
1.15.0
3 years ago
1.16.0
3 years ago
1.14.0
3 years ago
1.8.0
3 years ago
0.0.0-PLACEHOLDER
3 years ago
1.7.0
4 years ago
1.6.0
4 years ago
1.5.0
4 years ago
1.4.0
4 years ago
1.3.1
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago