Skip to content

Commit

Permalink
Version 0.7.1 - publish on jsr.io
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenmacdonald committed Mar 3, 2024
1 parent 7ae5edd commit b8af26b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 17 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# deno-s3-lite-client
# s3-lite-client

This is a lightweight S3 client for Deno, designed to offer all the key features you may need, with no dependencies
outside of the Deno standard library. It does not use any Deno-specific features, so it should work with any modern
JavaScript runtime that supports the `fetch` API and URL imports.
This is a lightweight S3 client for Deno and other modern JavaScript runtimes. It is designed to offer all the key
features you may need, with no dependencies outside of the Deno standard library. It does not use any Deno-specific
features, so it should work with any runtime that supports the `fetch` API, web streams API, and ES modules (ESM).

This client is 100% MIT licensed, and is derived from the excellent
[MinIO JavaScript Client](https://github.com/minio/minio-js).
Expand Down Expand Up @@ -39,7 +39,7 @@ Supported functionality:
List data files from a public data set on Amazon S3:

```typescript
import { S3Client } from "https://deno.land/x/s3_lite_client@0.7.0/mod.ts";
import { S3Client } from "@bradenmacdonald/s3-lite-client";

const s3client = new S3Client({
endPoint: "s3.us-east-1.amazonaws.com",
Expand Down Expand Up @@ -75,7 +75,7 @@ const keys = await Array.fromAsync(s3client.listObjects(), (entry) => entry.key)
Uploading and downloading a file using a local MinIO server:

```typescript
import { S3Client } from "https://deno.land/x/s3_lite_client@0.7.0/mod.ts";
import { S3Client } from "@bradenmacdonald/s3-lite-client";

// Connecting to a local MinIO server:
const s3client = new S3Client({
Expand Down Expand Up @@ -129,7 +129,7 @@ Then while MinIO is running, run
deno test --allow-net integration.ts
```

To debug what MinIO is seeing, run these two commands:
(If you encounter issues and need to debug what MinIO is seeing, run these two commands:)

```sh
mc alias set localdebug http://localhost:9000 AKIA_DEV secretkey
Expand Down
8 changes: 4 additions & 4 deletions client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class Client {
readonly sessionToken?: string;
readonly defaultBucket: string | undefined;
readonly region: string;
readonly userAgent = "deno-s3-lite-client";
readonly userAgent = "s3-lite-client";
/** Use path-style requests, e.g. https://endpoint/bucket/object-key instead of https://bucket/object-key */
readonly pathStyle: boolean;

Expand Down Expand Up @@ -173,7 +173,7 @@ export class Client {
this.region = params.region;
}

protected getBucketName(options: undefined | { bucketName?: string }) {
protected getBucketName(options: undefined | { bucketName?: string }): string {
const bucketName = options?.bucketName ?? this.defaultBucket;
if (bucketName === undefined || !isValidBucketName(bucketName)) {
throw new errors.InvalidBucketNameError(
Expand Down Expand Up @@ -477,7 +477,7 @@ export class Client {
expirySeconds?: number;
requestDate?: Date;
} = {},
) {
): Promise<string> {
const { versionId, responseParams, ...otherOptions } = options;
const parameters: Record<string, string> = {
...responseParams,
Expand Down Expand Up @@ -714,7 +714,7 @@ export class Client {
* - maximum of 10,000 parts per upload
* - maximum object size of 5TB
*/
protected calculatePartSize(size: number | undefined) {
protected calculatePartSize(size: number | undefined): number {
if (size === undefined) {
// If we don't know the total size (e.g. we're streaming data), assume it's
// the largest allowed object size, so we can guarantee the upload works
Expand Down
9 changes: 8 additions & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"name": "@bradenmacdonald/s3-lite-client",
"version": "0.7.1",
"exports": "./mod.ts",
"fmt": {
"lineWidth": 120
},
"lock": false
"lock": false,
"imports": {
"@std/assert": "jsr:@std/assert@^0.218",
"@std/io": "jsr:@std/io@^0.218"
}
}
8 changes: 4 additions & 4 deletions deps-tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { assert } from "https://deno.land/std@0.215.0/assert/assert.ts";
export { assertEquals } from "https://deno.land/std@0.215.0/assert/assert_equals.ts";
export { assertInstanceOf } from "https://deno.land/std@0.215.0/assert/assert_instance_of.ts";
export { assertRejects } from "https://deno.land/std@0.215.0/assert/assert_rejects.ts";
export { assert } from "@std/assert/assert";
export { assertEquals } from "@std/assert/assert_equals";
export { assertInstanceOf } from "@std/assert/assert_instance_of";
export { assertRejects } from "@std/assert/assert_rejects";
2 changes: 1 addition & 1 deletion deps.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { Buffer } from "https://deno.land/std@0.215.0/io/buffer.ts";
export { Buffer } from "@std/io/buffer";

0 comments on commit b8af26b

Please sign in to comment.