
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
aws-s3-cg-lib
Advanced tools
[](https://www.cloudgensys.com/)
https://github.com/CloudGenUser/aws-s3-cg-lib
This code has the objective to establish a connection with the AWS S3 bucket service and depending of the option selected (with the flag property) it will make a different operation in the AWS bucket.
The next are the possible flags and their corresponding actions:
Any other flag will be consider as an invalid values and will return an error message.
The purpose of this library is to handle S3 buckets in the AWS, getting information from the files in the bucket and other operations with the content of the bucket. Also, directories inside the bucket can be handled.
The library can be installed from npm page with the next:
npm install aws-s3-cg-lib
, npm i aws-s3-cg-lib
or yarn install aws-s3-cg-lib
The content and fileName properties are not required for this operation
{
"flag":"CREATETBUCKET",
"region":"us-east-1",
"accessKey":"ACCESSKEYSTRING",
"secretKey":"SECRETKEYSTRING",
"bucketName":"bucketGrants"
}
Resultant sample:
{
response: "Bucket created successfully at x location."
}
In case of some error the library will return the corresponding exception in the AWS S3 service.
The content and fileName properties are not required for this operation
{
"flag":"DELETEBUCKET",
"region":"us-east-1",
"accessKey":"ACCESSKEYSTRING",
"secretKey":"SECRETKEYSTRING",
"bucketName":"bucketGrants"
}
Resultant sample:
{
response:"Bucket bucketTest was successfully removed."
}
In case of some error the library will return the corresponding exception in the AWS S3 service.
The content and fileName properties are not required for this operation
{
"flag":"GETBUCKETGRANTS",
"region":"us-east-1",
"accessKey":"ACCESSKEYSTRING",
"secretKey":"SECRETKEYSTRING",
"bucketName":"bucketGrants"
}
Resultant sample:
{
"grants": [
{
"Grantee": {
"DisplayName": "displayName",
"ID": "1234567890123456789012345678901234567890123456789012345678901234",
"Type": "CanonicalUser"
},
"Permission": "FULL_CONTROL"
}
]
}
In case of some error the library will return the corresponding exception in the AWS S3 service.
The content property is not required for this operation
{
"flag":"GETFILE",
"region":"us-east-1",
"accessKey":"ACCESSKEYSTRING",
"secretKey":"SECRETKEYSTRING",
"bucketName":"scdf-cg-bucket",
"fileName":"testFile.txt"
}
Resultant sample:
{
"content": "[{"mailFrom": "test@mail.com", "mailPerson": "john Smith"}]"
}
In case of some error the library will return the corresponding exception in the AWS S3 service.
The content, bucket and fileName properties are not required for this operation
{
"flag":"GETLISTBUCKETS",
"region":"us-east-1",
"accessKey":"ACCESSKEYSTRING",
"secretKey":"SECRETKEYSTRING"
}
Resultant sample:
{
"response": [
{
"Name": "bucket1",
"CreationDate": "2022-01-01T10:10:10.000Z"
},
{
"Name": "bucket2",
"CreationDate": "2022-01-01T10:10:10.000Z"
}
]
}
In case of some error the library will return the corresponding exception in the AWS S3 service.
The content and fileName properties are not required for this operation
{
"flag":"GETLISTFILESINBUCKET",
"region":"us-east-1",
"accessKey":"ACCESSKEYSTRING",
"secretKey":"SECRETKEYSTRING",
"bucketName":"bucketTest"
}
Resultant sample:
{
"response": {
"IsTruncated": false,
"Marker": "",
"Contents": [
{
"Key": "testFile.txt",
"LastModified": "2022-01-01T10:10:22.000Z",
"ETag": "\"e8d78389ed292fbbe91153exb8e0bae4-9\"",
"ChecksumAlgorithm": [],
"Size": 78858823,
"StorageClass": "STANDARD",
"Owner": {
"DisplayName": "xrnadmin_us",
"ID": "efdba54569b1468058a276bcd4b0f662b728f4a9401186dda9357d949e123456"
}
},
{
"Key": "buckets-s3/",
"LastModified": "2022-01-01T10:10:22.000Z",
"ETag": "\"d41d8cd98f00b204e9812345acf8427e\"",
"ChecksumAlgorithm": [],
"Size": 0,
"StorageClass": "STANDARD",
"Owner": {
"DisplayName": "xraadmin_us",
"ID": "efdba14219b4546789a276bcd4b0f662b728f4a9401186dda9357d949e179520"
}
}
],
"Name": "listBucket",
"Prefix": "",
"MaxKeys": 1000,
"CommonPrefixes": []
}
}
In case of some error the library will return the corresponding exception in the AWS S3 service.
Arguments: - flag: The string that contains the action to be executed, one of the next options can be selected: CREATETBUCKET, DELETEBUCKET, GETBUCKETGRANTS, GETFILE, GETLISTBUCKETS, GETLISTFILESINBUCKET, UPLOADFILE. The string is not case sensitive. In this case the option UPLOADFILE is selected. - accessKey: It is the key to grant the access to the Amazon services. - secretKey: It is the password to access with the related key to the Amazon services. - region: It is a code that corresponds to the zone of the services in wich the Amazon services are alocated according with the user contract to use the AWS services, the list of codes and what is the neares code in user zone can be reviewed in the next link: https://aws.amazon.com/es/about-aws/global-infrastructure/regions_az/ - bucketName: The name of the bucket in which is going to be performed the actions that includes the creation, deletion, to know grants, to search a file, to get the list of files or create the file. - content: It corresponds to the content of a file when the option to create a file is selected. - fileName: The name of the file to be created.
Description: This request will create a copy of a file inside a specific bucket in the AWS S3 account.
Sample request:
{
"flag":"GETLISTFILESINBUCKET",
"region":"us-east-1",
"accessKey":"ACCESSKEYSTRING",
"secretKey":"SECRETKEYSTRING",
"bucketName":"bucketTest",
"content": "Hello World.",
"fileName": "myFile.txt"
}
Resultant sample:
{
response:"File myFile.txt was successfully uploaded in bucketTest."
}
In case of some error the library will return the corresponding exception in the AWS S3 service.
FAQs
Library to connect, extract and obtain data from AWS S3 buckets.
The npm package aws-s3-cg-lib receives a total of 2 weekly downloads. As such, aws-s3-cg-lib popularity was classified as not popular.
We found that aws-s3-cg-lib demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.