Skip to content

Commit 0468635

Browse files
committed
Fix typo
1 parent 6caa384 commit 0468635

File tree

7 files changed

+25
-25
lines changed

7 files changed

+25
-25
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ Upload a file in a streaming manner
308308

309309
#### Browser
310310

311-
- stategy [BrowserUploadStategy](./src/data/browser-upload.ts#L5)
311+
- strategy [BrowserUploadStrategy](./src/data/browser-upload.ts#L5)
312312
- returns [UploadResponse](./src/data/types.ts#L17)
313313

314314
Example:
@@ -322,9 +322,9 @@ const onProgress = (loaded, total) => {
322322

323323
const metadata = { filename: "foo.xt", mimetype: "text/plain" };
324324

325-
const stategy = new BrowserUploadStategy(file, onProgress, metadata);
325+
const strategy = new BrowserUploadStrategy(file, onProgress, metadata);
326326

327-
const uploadResponse = data.upload(stategy);
327+
const uploadResponse = data.upload(strategy);
328328

329329
const res = await uploadResponse.result;
330330

@@ -338,14 +338,14 @@ console.info("CID is", res.data);
338338

339339
#### Node
340340

341-
- stategy [NodeUploadStategy](./src/data/node-upload.ts#L9)
341+
- strategy [NodeUploadStrategy](./src/data/node-upload.ts#L9)
342342
- returns [UploadResponse](./src/data/types.ts#L17)
343343

344344
Example:
345345

346346
```js
347-
const stategy = new NodeUploadStategy("Hello World !");
348-
const uploadResponse = data.upload(stategy);
347+
const strategy = new NodeUploadStrategy("Hello World !");
348+
const uploadResponse = data.upload(strategy);
349349

350350
const res = await uploadResponse.result;
351351

examples/upload-browser/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Codex } from "@codex-storage/sdk-js";
2-
import { BrowserUploadStategy } from "@codex-storage/sdk-js/browser";
2+
import { BrowserUploadStrategy } from "@codex-storage/sdk-js/browser";
33

44
async function main() {
55
const codex = new Codex(process.env.CODEX_NODE_URL);
@@ -19,9 +19,9 @@ async function main() {
1919
mimetype: "text/plain",
2020
};
2121

22-
const stategy = new BrowserUploadStategy(file, onProgress, metadata);
22+
const strategy = new BrowserUploadStrategy(file, onProgress, metadata);
2323

24-
const uploadResponse = data.upload(stategy);
24+
const uploadResponse = data.upload(strategy);
2525

2626
const res = await uploadResponse.result;
2727

examples/upload-node/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
const { Codex } = require("@codex-storage/sdk-js");
2-
const { NodeUploadStategy } = require("@codex-storage/sdk-js/node");
2+
const { NodeUploadStrategy } = require("@codex-storage/sdk-js/node");
33

44
async function main() {
55
const codex = new Codex(
66
process.env.CODEX_NODE_URL || "http://localhost:8080"
77
);
88
const data = codex.data;
99

10-
const stategy = new NodeUploadStategy("Hello World !");
11-
const uploadResponse = data.upload(stategy);
10+
const strategy = new NodeUploadStrategy("Hello World !");
11+
const uploadResponse = data.upload(strategy);
1212

1313
const res = await uploadResponse.result;
1414

src/data/browser-upload.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { CodexError } from "../errors/errors";
22
import type { SafeValue } from "../values/values";
3-
import type { UploadStategy, UploadStategyOptions } from "./types";
3+
import type { UploadStrategy, UploadStrategyOptions } from "./types";
44

5-
export class BrowserUploadStategy implements UploadStategy {
5+
export class BrowserUploadStrategy implements UploadStrategy {
66
private readonly file: Document | XMLHttpRequestBodyInit;
77
private readonly onProgress:
88
| ((loaded: number, total: number) => void)
@@ -24,7 +24,7 @@ export class BrowserUploadStategy implements UploadStategy {
2424

2525
upload(
2626
url: string,
27-
{ auth }: UploadStategyOptions
27+
{ auth }: UploadStrategyOptions
2828
): Promise<SafeValue<string>> {
2929
const xhr = new XMLHttpRequest();
3030
this.xhr = xhr;

src/data/data.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
import type { SafeValue } from "../values/values";
88
import type {
99
CodexDataResponse,
10-
UploadStategy,
10+
UploadStrategy,
1111
UploadResponse,
1212
CodexSpaceResponse,
1313
CodexNodeSpace,
@@ -70,13 +70,13 @@ export class CodexData {
7070
* XMLHttpRequest is used instead of fetch for this case, to obtain progress information.
7171
* A callback onProgress can be passed to receive upload progress data information.
7272
*/
73-
upload(stategy: UploadStategy): UploadResponse {
73+
upload(strategy: UploadStrategy): UploadResponse {
7474
const url = this.url + Api.config.prefix + "/data";
7575

7676
return {
77-
result: stategy.upload(url, { auth: this.auth }),
77+
result: strategy.upload(url, { auth: this.auth }),
7878
abort: () => {
79-
stategy.abort();
79+
strategy.abort();
8080
},
8181
};
8282
}

src/data/node-upload.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { CodexError } from "../errors/errors";
33
import type { SafeValue } from "../values/values";
44
import Undici from "undici";
55
import { type FormData } from "undici";
6-
import type { UploadStategy, UploadStategyOptions } from "./types";
6+
import type { UploadStrategy, UploadStrategyOptions } from "./types";
77
import { FetchAuthBuilder } from "../fetch-safe/fetch-safe";
88

9-
export class NodeUploadStategy implements UploadStategy {
9+
export class NodeUploadStrategy implements UploadStrategy {
1010
private readonly body:
1111
| string
1212
| Buffer
@@ -29,7 +29,7 @@ export class NodeUploadStategy implements UploadStategy {
2929

3030
async upload(
3131
url: string,
32-
{ auth }: UploadStategyOptions
32+
{ auth }: UploadStrategyOptions
3333
): Promise<SafeValue<string>> {
3434
const headers: Record<string, string> = FetchAuthBuilder.build(auth);
3535

src/data/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ export type CodexFetchManifestResponse =
2929

3030
export type CodexManifest = CodexFetchManifestResponse;
3131

32-
export type UploadStategyOptions = {
32+
export type UploadStrategyOptions = {
3333
auth?: FetchAuth;
3434
};
3535

36-
export interface UploadStategy {
36+
export interface UploadStrategy {
3737
upload(
3838
url: string,
39-
options?: UploadStategyOptions
39+
options?: UploadStrategyOptions
4040
): Promise<SafeValue<string>>;
4141
abort(): void;
4242
}

0 commit comments

Comments
 (0)