Skip to content

Commit

Permalink
docs: update usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel-G committed Nov 27, 2023
1 parent 74790ee commit a302912
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
18 changes: 13 additions & 5 deletions packages/blockstore-s3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,22 @@ A Blockstore implementation that stores blocks on Amazon S3.
If the flag `createIfMissing` is not set or is false, then the bucket must be created prior to using blockstore-s3. Please see the AWS docs for information on how to configure the S3 instance. A bucket name is required to be set at the s3 instance level, see the below example.

```js
import S3 from 'aws-sdk/clients/s3.js'
import { S3 } from '@aws-sdk/client-s3'
import { S3Blockstore } from 'blockstore-s3'

const s3Instance = new S3({ params: { Bucket: 'my-ipfs-bucket' } })
const store = new S3Blockstore('.ipfs/blockstore', {
s3: s3Instance
createIfMissing: false
const s3 = new S3({
region: 'region',
credentials: {
accessKeyId: 'myaccesskey',
secretAccessKey: 'mysecretkey'
}
})

const store = new S3Blockstore(
s3,
'my-bucket',
{ path: '.ipfs/blockstore', createIfMissing: false }
)
```

## Example
Expand Down
18 changes: 13 additions & 5 deletions packages/datastore-s3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,22 @@ A Datastore implementation that stores data on Amazon S3.
If the flag `createIfMissing` is not set or is false, then the bucket must be created prior to using datastore-s3. Please see the AWS docs for information on how to configure the S3 instance. A bucket name is required to be set at the s3 instance level, see the below example.

```js
import S3 from 'aws-sdk/clients/s3.js'
import { S3 } from '@aws-sdk/client-s3'
import { S3Datastore } from 'datastore-s3'

const s3Instance = new S3({ params: { Bucket: 'my-ipfs-bucket' } })
const store = new S3Datastore('.ipfs/datastore', {
s3: s3Instance
createIfMissing: false
const s3 = new S3({
region: 'region',
credentials: {
accessKeyId: 'myaccesskey',
secretAccessKey: 'mysecretkey'
}
})

const store = new DatastoreS3(
s3,
'my-bucket',
{ path: '.ipfs/datastore', createIfMissing: false }
)
```

## Example
Expand Down

0 comments on commit a302912

Please sign in to comment.