gulp-s3-uploader

1.0.6 • Public • Published

gulp-s3-uploader

Version 1.0.6

Insprired by gulp-s3-upload use for uploading assets to Amazon S3 servers with v3 api.

Install

npm install gulp-s3-uploader

Usage

Use same options as gulp-s3-upload but simplified.

import gulp from 'gulp';
import s3 from 'gulp-s3-uploader';

or in commonjs

const gulp = require('gulp');
const s3 = require('gulp-s3-uploader');

create client instance:

const s3Client = s3(clientConfig: ClientConfig);

type ClientConfig = Partial<S3ClientConfig> & {
  key?: string; // short of accessKeyId
  secret?: string; // short of secretAccessKey
  accessKeyId?: string; // your access key
  secretAccessKey?: string; // your secret key
}

see S3ClientConfig at S3Client Configuration

then use it in gulp:

gulp.src('src/**/*')
  .pipe(s3Client(pluginConfig: PluginConfig))
  .pipe(...)

type PluginConfig = Partial<PutObjectCommandInput> & {
    // the chartset added to mime type, then pass to Content-Type  default: 'utf8'
    charset?: string;
    // the etag hash algorithm to hasha, default: 'md5'
    etagHash?: hasha.AlgorithmName;
    // if true, will not upload if there is no change
    uploadNewFilesOnly?: boolean;
    // this function could fix the PluginConfig params by keyname during runtime
    maps?: Record<keyof PluginConfig, (keyname: string) => any>;
    // transform each keyname before upload
    keyTransform?: (keyname: string) => string;
    // no change callback
    onNoChange?: (keyname: string) => void;
    // change callback
    onChange?: (keyname: string) => void;
    // new file callback
    onNew?: (keyname: string) => void;
} & Record<string, any>

see PutObjectCommandInput at PutObjectCommand

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i gulp-s3-uploader

Weekly Downloads

10

Version

1.0.6

License

MIT

Unpacked Size

74.3 kB

Total Files

13

Last publish

Collaborators

  • hua_code