Is there any Amazon S3 client library for Node.js that allows listing of all files in S3 bucket?
The most known aws2js and knox don't seem to have this functionality.
Node. js is primarily used for non-blocking, event-driven servers, due to its single-threaded nature. It's used for traditional web sites and back-end API services, but was designed with real-time, push-based architectures in mind.
A common misconception among developers is that Node. js is a backend framework and is only used for building servers. This isn't true: Node. js can be used both on the frontend and the backend.
Node is better for web applications and website development whereas Python is best suitable for back-end applications, numerical computations and machine learning. Nodejs utilize JavaScript interpreter whereas Python uses CPython as an interpreter.
Is Node JS a Language? No. Node JS is not a programming language, but it allows developers to use JavaScript, which is a programming language that allows users to build web applications. This tool is mostly used by programmers who use JavaScript to write Server-Side scripts.
Using the official aws-sdk:
var allKeys = []; function listAllKeys(marker, cb) { s3.listObjects({Bucket: s3bucket, Marker: marker}, function(err, data){ allKeys.push(data.Contents); if(data.IsTruncated) listAllKeys(data.NextMarker, cb); else cb(); }); }
see s3.listObjects
Edit 2017: Same basic idea, but listObjectsV2( ... )
is now recommended and uses a ContinuationToken
(see s3.listObjectsV2):
var allKeys = []; function listAllKeys(token, cb) { var opts = { Bucket: s3bucket }; if(token) opts.ContinuationToken = token; s3.listObjectsV2(opts, function(err, data){ allKeys = allKeys.concat(data.Contents); if(data.IsTruncated) listAllKeys(data.NextContinuationToken, cb); else cb(); }); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With