Don't know the right place to ask howto questions for Knox [couldn't find a wiki/doc beyond the Readme.md...]
I want to write the output of a db query directly to S3 to use Cloudfront as my database cache. This does not involve an fs.readFile rather a db.find() query which I want to put the result to S3 as a JSON object.
Is this possible? or do I need to write it as a temporary file on my fs and then read/put it to S3?
if you look at the source (or i think in the readme as well) you can stream arbitrary data to s3, the putFile stuff etc are just sugar on top of this
Did you manage to get this working? I have checked out client.putStream but can't get it working as throws TypeError: Bad argument at Object.stat (fs.js:402:11) when I feed the method a JSON object
TypeError: Bad argument at Object.stat (fs.js:402:11)
Any update on how to do this? I have the exact same need.
I figured out that I could do new Buffer(someJSON, 'binary'), feed it to client.put and get it working.
new Buffer(someJSON, 'binary')
Thanks! I thought I had tried that already but apparently not.
Well. It would be nice if this could be mentioned in the docs though. It took me some time to figure it out.
I'll use this bug to track the fact we need to better document how to put buffers, text, etc. directly into S3.
Add test for PUTing a string. Helps with #33.
Update README with string-PUTing example. Closes #33.
This is also great because I hated showing PUTing a file via buffering it into memory, since that's a bad idea. Now we have a legit example for PUT.