I am writing node js script which should send images from directory '/images/'
, to the amazon s3. I know the knox is very good library, but how can I upload all files from directory, with the old file names. I can probably use fs module, get all names and upload it with for
loop. Is there any function in knox which can do this?
Asked
Active
Viewed 783 times
0

ben75
- 29,217
- 10
- 88
- 134

Slow Harry
- 1,857
- 3
- 24
- 42
2 Answers
1
Knox does not provide any functionality for client-side file handling. You need to find your files manually and upload them one after one.
Unfortunately its impossible to upload multiple files once. The problem is that S3 requires that you send the Content-Length header for every file.

medokin
- 610
- 9
- 21
-
so is it possible to do it with console script? I am talking about headers. – Slow Harry Apr 16 '14 at 11:58
-
I mean uploading files one after one – Slow Harry Apr 16 '14 at 12:00
-
Sure, that's what loops are for. Do you need further help? – medokin Apr 16 '14 at 12:18
1
Why not use the command line tool s3cmd ( http://s3tools.org/s3cmd ) ? If you really want to do it in node.js, you can spawn a process to execute s3cmd in your javascript code.

Vince Yuan
- 10,533
- 3
- 32
- 27