Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucacasonato/deno_s3
Amazon S3 for Deno
https://github.com/lucacasonato/deno_s3
aws deno s3
Last synced: 8 days ago
JSON representation
Amazon S3 for Deno
- Host: GitHub
- URL: https://github.com/lucacasonato/deno_s3
- Owner: lucacasonato
- License: mit
- Created: 2020-06-24T10:14:17.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-07-25T03:51:21.000Z (over 1 year ago)
- Last Synced: 2024-10-25T15:48:47.712Z (14 days ago)
- Topics: aws, deno, s3
- Language: TypeScript
- Homepage: http://deno.land/x/s3
- Size: 116 KB
- Stars: 54
- Watchers: 7
- Forks: 14
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - lucacasonato/deno_s3 - Amazon S3 for Deno (deno)
README
# deno_s3
![ci](https://github.com/lucacasonato/deno_aws_sign_v4/workflows/ci/badge.svg)
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/[email protected]/mod.ts)
[![Coverage Status](https://coveralls.io/repos/github/lucacasonato/deno_s3/badge.svg?branch=main)](https://coveralls.io/github/lucacasonato/deno_s3?branch=main)Amazon S3 for Deno
> ⚠️ This project is work in progress. Expect breaking changes.
## Example
```ts
import { S3, S3Bucket } from "https://deno.land/x/[email protected]/mod.ts";// Create a S3 instance.
const s3 = new S3({
accessKeyID: Deno.env.get("AWS_ACCESS_KEY_ID")!,
secretKey: Deno.env.get("AWS_SECRET_ACCESS_KEY")!,
region: "us-east-1",
endpointURL: Deno.env.get("S3_ENDPOINT_URL"),
});// Create a new bucket.
let bucket = await s3.createBucket("test", { acl: "private" });// Get an existing bucket.
bucket = s3.getBucket("test");// Create a bucket instance manuely.
bucket = new S3Bucket({
accessKeyID: Deno.env.get("AWS_ACCESS_KEY_ID")!,
secretKey: Deno.env.get("AWS_SECRET_ACCESS_KEY")!,
bucket: "test",
region: "us-east-1",
endpointURL: Deno.env.get("S3_ENDPOINT_URL"),
});const encoder = new TextEncoder();
// Put an object into a bucket.
await bucket.putObject("test", encoder.encode("Test1"), {
contentType: "text/plain",
});// Retrieve an object from a bucket.
const { body } = await bucket.getObject("test");
const data = await new Response(body).text();
console.log("File 'test' contains:", data);// List objects in the bucket.
const list = bucket.listAllObjects({});
for await (const obj of list) {
console.log("Item in bucket:", obj.key);
}// Delete an object from a bucket.
await bucket.deleteObject("test");
```## Contributing
To run tests you need to Docker and docker-compose installed.
```
make test
```