Skip to content

Commit

Permalink
chore: Update README and CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
loune committed Dec 28, 2023
1 parent 45e74e1 commit fa653c4
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [6.1.1] - 2023-12-28

### Fixed

- Content type detection with `.js` files.
- Content type detection with filenames containing multiple `.`.

## [6.1.0] - 2023-10-25

### Changed
Expand Down
120 changes: 118 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ yarn add snap-push @google-cloud/storage
$ cd dist && ../node_modules/.bin/snap-push './**/*' s3://example-bucket --public
```

### Using the Library
### Using the Library with S3

CommonJS require

Expand All @@ -78,7 +78,123 @@ const providerOptions = {

(async () => {
const result = await push({
currentWorkingDirectory: 'dist',
currentWorkingDirectory: 'directory-to-upload',
files: './**/*',
makePublic: true,
provider: s3FileProvider(providerOptions),
});

console.log(result);
})();
```

### Using the Library with Azure

CommonJS require

```js
const push = require('snap-push').default;
const azureFileProvider = require('snap-push/azure').default;
```

ES Modules import

```js
import push from 'snap-push';
import azureFileProvider from 'snap-push/azure';
```

Code

```typescript
const providerOptions: AzureProviderOptions = {
credential: new StorageSharedKeyCredential(
'my-account-name',
'my-account-key'
),
serviceUrl: `https://myaccount.blob.core.windows.net/`,
containerName: `my-test-container`,
};

(async () => {
const result = await push({
currentWorkingDirectory: 'directory-to-upload',
files: './**/*',
makePublic: true,
provider: azureFileProvider(providerOptions),
});

console.log(result);
})();
```

### Using the Library with Google Cloud Storage

CommonJS require

```js
const push = require('snap-push').default;
const gcpFileProvider = require('snap-push/gcp').default;
```

ES Modules import

```js
import push from 'snap-push';
import gcpFileProvider from 'snap-push/gcp';
```

Code

```js
const providerOptions = {
bucket: 'example-bucket'
};

(async () => {
const result = await push({
currentWorkingDirectory: 'directory-to-upload',
files: './**/*',
makePublic: true,
provider: gcpFileProvider(providerOptions),
});

console.log(result);
})();
```

### Using the Library with Cloudflare R2

CommonJS require

```js
const push = require('snap-push').default;
const s3FileProvider = require('snap-push/s3').default;
```

ES Modules import

```js
import push from 'snap-push';
import s3FileProvider from 'snap-push/s3';
```

Code

```js
const providerOptions = {
bucket: 'example-bucket',
region: 'auto',
endpoint: `https://my-region-endpoint.r2.cloudflarestorage.com`,
credentials: {
accessKeyId: 'my-account-key',
secretAccessKey: 'my-secret-access-key',
},
};

(async () => {
const result = await push({
currentWorkingDirectory: 'directory-to-upload',
files: './**/*',
makePublic: true,
provider: s3FileProvider(providerOptions),
Expand Down

0 comments on commit fa653c4

Please sign in to comment.