Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set custom Content-Encoding header on a per file basis #22

Merged
merged 2 commits into from
Aug 21, 2015

Conversation

rufman
Copy link
Contributor

@rufman rufman commented Aug 20, 2015

Like metadataMap, manualContentEncoding allows you to set the Content-Encoding header using some arbitrary logic in a function:

    gulp.task("upload", function() {
        gulp.src("./dir/to/upload/**")
        .pipe(s3({
            Bucket: 'example-bucket',
            ACL: 'public-read',
            manualContentEncoding: function(keyname) {
                var contentEncoding = null;

                if (keyname.indexOf('.gz') !== -1) {
                  contentEncoding = 'gzip';
                }
                return contentEncoding;
            }
        }));
    });

This is useful for when S3's auto content encoding detection won't work for you (like when you need to support gzipped files on older browsers where the extension needs to be .gz.js and not .js.gz).

@clineamb clineamb merged commit cc60fae into clineamb:master Aug 21, 2015
@clineamb
Copy link
Owner

Thanks for this, and modeling it after metadataMap!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants