Provides a readable stream of keys beneath the provided S3 prefix
-
s3urlstring an S3 uri of the types3://bucket/prefix -
optionsobject? options to provide to the readable stream
require('s3scan').List('s3://my-bucket/my-key')
.pipe(process.stdout);Returns object a readable stream of line-delimited keys
Provides a transform stream that expects you to write line-delimited S3 keys into it, and transforms them into a readable stream of S3.getObject responses
-
bucketstring the S3 bucket from which to fetch keys -
optionsobject? options to provide to the transform streamoptions.agentobject? an HTTPS agent to use for S3 requestsoptions.s3object? an S3 client to use to make requestsoptions.passErrorsboolean? iftrue, any error objects encountered will be passed into the readable streamoptions.keysboolean? iftrue,.RequestParameters(bucket and key) will be attached to the objects passed into the readable streamoptions.gunzipboolean? iftrue, gunzip each object bodyoptions.bodyboolean? iftruestream only the object body from response objectsoptions.concurrencynumber? concurrency at which to request objects
require('s3scan').Get('my-bucket')
.on('data', function(d) {
console.log(JSON.stringify(d));
})
.write('some-key\n');Returns object a transform stream
Provides a writable stream that expects you to write line-delimited S3 keys into it, and performs an S3.deleteObject request on each key
-
bucketstring the S3 bucket from which to fetch keys -
optionsobject? options to provide to the writable stream
require('s3scan').Delete('my-bucket')
.write('some-key\n');Returns object a writable stream
Provides a readable stream of S3.getObject responses for all keys beneath the provided S3 prefix
-
s3urlstring an S3 uri of the types3://bucket/prefix -
optionsobject? configuration optionsoptions.agentobject? an HTTPS agent to use for S3 requestsoptions.s3object? an S3 client to use to make requestsoptions.concurrencynumber? concurrency at which to request objectsoptions.passErrorsboolean? iftrue, any error objects encountered will be passed into the readable streamoptions.keysboolean? iftrue,.RequestParameters(bucket and key) will be attached to the objects passed into the readable stream
require('s3scan').Scan('s3://my-bucket/my-key')
.on('data', function(d) {
console.log(JSON.stringify(d));
});Returns object a readable stream
Deletes all objects beneath an S3 prefix
-
s3urlstring an S3 uri of the types3://bucket/prefix -
optionsobject? configuration options -
callbackfunction? a function to run on error or on completion of deletes
require('s3scan').Purge('s3://my-bucket/my-key', function(err) {
if (err) throw err;
console.log('deleted all the things!');
});Returns object a writable stream
Provides a writable stream that accepts keys and copies them to another location.
-
fromBucketstring the bucket to copy objects from -
toBucketstring the bucket to copy objects into -
keyTransformfunction? a function to transform keys. The function you provide should accept a source key and synchronously return the desired destination key. If not provided, objects in thefromBucketwill be copied to thetoBucketas-is. -
optionsobject? options to provide to the writable stream.
Returns object a writable stream