Publish files with oss
-
- Can publish files with prefix and shortId
-
- Simple
-
- Usable
When genShortId enabled: oss key will be ${prefix}/${shortId}/${filePath}
otherwise oss key should like this ${prefix}/${filePath}
npm install gulp-oss-publish
import publish from 'gulp-oss-publish';
gulp.task('publish', () =>
gulp
.src('dist/**/*', {
base: 'dist',
buffer: true
})
.pipe(publish({
prefix: 'a/puca-web',
genShortId: true,
oss: {
accessKeyId: 'xxx',
secretAccessKey: 'yyy',
endpoint: 'http://oss-cn-hangzhou.aliyuncs.com',
bucket: 'your-bucket-name'
},
headers: {
CacheControl: 'no-cache',
ServerSideEncryption: 'AES256'
}
}))
);