Skip to content

Commit 5ae81b8

Browse files
docs(readme): fix code examples format in readme (#2284)
Co-authored-by: Trivikram Kamat <[email protected]>
1 parent ca6f146 commit 5ae81b8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Diff for: README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ guide and API reference for service specific details.
243243

244244
**Bare-bones clients/commands**: This refers to a modular way of consuming individual operations on JS SDK clients. It results in less code being imported and thus more performant. It is otherwise equivlent to the aggregated clients/commands.
245245

246-
```
246+
```javascript
247247
// this imports a bare-bones version of S3 that exposes the .send operation
248248
import { S3Client } from "@aws-sdk/client-s3"
249249

@@ -257,7 +257,7 @@ await bareBonesS3.send(new GetObjectCommand({...}));
257257

258258
**Aggregated clients/commands**: This refers to a way of consuming clients that contain all operations on them. Under the hood this calls the bare-bones commands. This imports all commands on a particular client and results in more code being imported and thus less performant. This is 1:1 with v2's style.
259259

260-
```
260+
```javascript
261261
// this imports an aggregated version of S3 that exposes the .send operation
262262
import { S3 } from "@aws-sdk/client-s3"
263263

@@ -298,7 +298,7 @@ An async iterator is much like an iterator, except that its `next()` method retu
298298

299299
In v3, the clients expose paginateOperationName APIs that are written using async generators, allowing you to use async iterators in a for await..of loop. You can perform the paginateListTables operation from `@aws-sdk/client-dynamodb` as follows:
300300

301-
```
301+
```javascript
302302
const {
303303
DynamoDBClient,
304304
paginateListTables,
@@ -323,7 +323,7 @@ for await (const page of paginator) {
323323

324324
Or simplified:
325325

326-
```
326+
```javascript
327327
...
328328
const client = new DynamoDBClient({});
329329

@@ -341,7 +341,7 @@ In v3, we support the AbortController interface which allows you to abort reques
341341

342342
The [AbortController Interface](https://dom.spec.whatwg.org/#interface-abortcontroller) provides an `abort()` method that toggles the state of a corresponding AbortSignal object. Most APIs accept an AbortSignal object, and respond to `abort()` by rejecting any unsettled promise with an “AbortError”.
343343

344-
```
344+
```javascript
345345
// Returns a new controller whose signal is set to a newly created AbortSignal object.
346346
const controller = new AbortController();
347347

@@ -357,7 +357,7 @@ controller.abort();
357357

358358
In JavaScript SDK v3, we added an implementation of WHATWG AbortController interface in `@aws-sdk/abort-controller`. To use it, you need to send `AbortController.signal` as `abortSignal` in the httpOptions parameter when calling `.send()` operation on the client as follows:
359359

360-
```
360+
```javascript
361361
const { AbortController } = require("@aws-sdk/abort-controller");
362362
const { S3Client, CreateBucketCommand } = require("@aws-sdk/client-s3");
363363

@@ -385,7 +385,7 @@ For a full pagination deep dive please check out our [blog post](https://aws.ama
385385

386386
The following code snippet shows how to upload a file using S3's putObject API in the browser with support to abort the upload. First, create a controller using the `AbortController()` constructor, then grab a reference to its associated AbortSignal object using the AbortController.signal property. When the `PutObjectCommand` is called with `.send()` operation, pass in AbortController.signal as abortSignal in the httpOptions parameter. This will allow you to abort the PutObject operation by calling `abortController.abort()`.
387387

388-
```#JavaScript
388+
```javascript
389389
const abortController = new AbortController();
390390
const abortSignal = abortController.signal;
391391

@@ -425,7 +425,7 @@ A middleware is a higher-order function that transfers user input and/or HTTP re
425425

426426
For example, you can use middleware to add a custom header like S3 object metadata:
427427

428-
```
428+
```javascript
429429
const { S3 } = require("@aws-sdk/client-s3");
430430
const client = new S3({ region: "us-west-2" });
431431
// Middleware added to client, applies to all commands.
@@ -456,7 +456,7 @@ The example above adds middleware to `build` step of middleware stack. The middl
456456
- The **deserialize** lifecycle step deserializes the raw response object to a structured response. The upstream middleware have access to deserialized data in next callbacks return value: `result.output`.
457457
Each middleware must be added to a specific step. By default each middleware in the same step has undifferentiated order. In some cases, you might want to execute a middleware before or after another middleware in the same step. You can achieve it by specifying its `priority`.
458458

459-
```
459+
```javascript
460460
client.middlewareStack.add(middleware, {
461461
step: "initialize",
462462
priority: "high", // or "low".

0 commit comments

Comments
 (0)