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

putStream with transfer-encoding chunked #322

Open
ccorcos opened this issue Jun 2, 2017 · 2 comments
Open

putStream with transfer-encoding chunked #322

ccorcos opened this issue Jun 2, 2017 · 2 comments

Comments

@ccorcos
Copy link

ccorcos commented Jun 2, 2017

I'm trying to stream a request response straight into S3, but I'm running into issues because the response is chunked and doesnt have a content-length:

headers:
   { 'content-type': 'image/jpeg',
     expires: 'Fri, 02 Jun 2017 22:05:16 GMT',
     date: 'Fri, 02 Jun 2017 22:05:16 GMT',
     'cache-control': 'private, max-age=0, must-revalidate, no-transform',
     vary: 'Accept, X-GData-Authorization, GData-Version',
     'gdata-version': '1.0',
     'transfer-encoding': 'chunked',
     'x-content-type-options': 'nosniff',
     'x-frame-options': 'SAMEORIGIN',
     'x-xss-protection': '1; mode=block',
     server: 'GSE',
     'alt-svc': 'quic=":443"; ma=2592000; v="38,37,36,35"',
     connection: 'close' },

Here's what I've got going (using the request package):

request.get(url)
	.on("response", (res) => {
		const path = randomID()
		const req = client.putStream(res, path, res.headers, function (err, res) {
			if (err) {
				reject(err)
			}
			else {
				resolve(req.url)
			}
		})
	})

I see you talked about it here and added that null check #92 but I got it working simply by removing that check...

@TooTallNate @rauchg

@devpascoe
Copy link

hmmm facing this too

@devpascoe
Copy link

i ended up having to save locally then putFile :(

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

No branches or pull requests

2 participants