
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@imrandil/aws-s3-stream-uploader
Advanced tools
A package to upload data streams to AWS S3 and generate signed URLs.
This package provides a convenient way to upload data streams, such as files, to Amazon S3 (Simple Storage Service) and generate signed URLs for accessing the uploaded content. It's particularly useful for scenarios where you need to upload large files or streams to S3 and share them securely with others.
You can install this package via npm:
npm install @imrandil/aws-s3-stream-uploader
To use this package, follow these simple steps:
const { uploadStreamToS3, getObjectURL, getURLAfterUploadToS3 } = require('@imrandil/aws-s3-stream-uploader');
const s3Config = {
region: 'your-region',
credentials: {
accessKeyId: 'your-access-key-id',
secretAccessKey: 'your-secret-access-key'
}
};
const stream = /* Your data stream */;
const bucket = 'your-bucket-name';
const key = 'your-file-key';
const expiresIn = 900; // Expiry time in seconds
const contentType = 'application/pdf'; // Set the content type dynamically
try {
await uploadStreamToS3(s3Config, bucket, key, stream, contentType);
console.log('Stream uploaded successfully');
} catch (error) {
console.error('Error uploading stream to S3:', error);
}
const signedURL = await getObjectURL(s3Config, bucket, key, expiresIn);
console.log('Signed URL:', signedURL);
try {
const contentType = 'application/pdf'; // Set the content type dynamically
const { success, signedURL } = await getURLAfterUploadToS3(s3Config, bucket, key, stream, expiresIn, contentType);
console.log('Signed URL:', signedURL);
} catch (error) {
console.error('Error in getURLAfterUploadToS3:', error);
}
uploadStreamToS3(s3Config, bucket, key, stream, contentType)
Uploads a stream to the specified S3 bucket.
s3Config
: The S3 configuration object containing region and credentials.bucket
: The name of the S3 bucket.key
: The key (path) under which to store the data in the bucket.stream
: The data stream to upload.contentType
: The MIME type of the content being uploaded.getObjectURL(s3Config, bucket, key, expiresIn)
Generates a signed URL for accessing the specified object in the S3 bucket.
s3Config
: The S3 configuration object containing region and credentials.bucket
: The name of the S3 bucket.key
: The key (path) of the object in the bucket.expiresIn
: The expiry time for the signed URL in seconds.getURLAfterUploadToS3(s3Config, bucket, key, stream, expiresIn, contentType)
Uploads a stream to S3 and generates a signed URL for accessing the uploaded content.
s3Config
: The S3 configuration object containing region and credentials.bucket
: The name of the S3 bucket.key
: The key (path) under which to store the data in the bucket.stream
: The data stream to upload.expiresIn
: The expiry time for the signed URL in seconds.contentType
: The MIME type of the content being uploaded.If you have any feedback or suggestions for improvements, feel free to open an issue on the GitHub repository. Your input is highly appreciated!
This package is licensed under the MIT License. See the LICENSE file for details.
FAQs
A package to upload data streams to AWS S3 and generate signed URLs.
The npm package @imrandil/aws-s3-stream-uploader receives a total of 1 weekly downloads. As such, @imrandil/aws-s3-stream-uploader popularity was classified as not popular.
We found that @imrandil/aws-s3-stream-uploader demonstrated a not healthy version release cadence and project activity because the last version was released 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
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.