Netlify upload file API: Please support deflate and gzip

Hi,

It will be great to be able to upload files with “application/deflate” and “application/gzip” while uploading file by Netlify API documentation .
I think it would save you descent amount of IO by reducing upload time; and with HTTP2 can replace zip file upload, I guess it will be efficient enough to do initial upload.

Thanks for developing great service!

Thanks for the feature request! Seems like a good idea to me (though of course you could upload a zip file instead if your main goal is compression):

We’ll follow up here if we implement it!

Actually - I am not sure we don’t handle it already. What happens when you post compressed as described in the first answer here (using the Content-Encoding header + compressing the file)?

1 Like

Unfortunately zip doesn’t allow (well, makes life hard) stream processing.
I tried “application/gzip” content type, but let me check Content-Encoding. Nice hint.

Unfortunately Content-Encoding: gzip doesn’t work
I got {"code":422,"message":"No records matched"} if uncompressed file sha1 is provided
Or if I provide sha1 for gzipped file it is deployed

curl --location --request PUT 'https://api.netlify.com/api/v1/deploys/{depliyId}/files/test_skr.htm' \
--header 'Content-Type: application/octet-stream' \
--header 'Content-Encoding: gzip' \
--header 'Authorization: Bearer XXXX' \
--data-binary '@test_skt1.txt.gz'

OK, thanks for doing that experiment for us! I filed a feature request and also asked our API team to take a look to see if they had any different suggestions than me, but if they don’t, I am not sure we’ll change the behavior anytime soon.

I suspect their advice will be “upload a zipfile of the whole site instead, in case a lot of the assets are compressible and it produces an overall savings in size to transmit”, and I know that isn’t what you’re hoping to hear. But, I’ll let you know if I hear anything else!