1.0.6 β’ Published 6 months ago
s3-url-generator v1.0.6
π Welcome to S3 URL Generator
S3 URL Generator simplifies the process of creating secure, pre-signed URLs for AWS S3 uploads and downloads. Whether you're working on file uploads, downloads, or batch operations, this package streamlines your workflow.
π Features
- Secure Upload & Download URLs: Generate pre-signed URLs with ease.
- Batch URL Generation: Create multiple download links in one go.
- Customizable Options: Tailor URLs for your specific use cases.
- Easy Integration: Simple API designed for developers.
π¦ Installation
Install the package via npm:
npm install s3-url-generator
π Usage
Hereβs how to use the S3 URL Generator:
const S3UrlGenerator = require('s3-url-generator');
// Initialize with AWS configuration
const urlGenerator = new S3UrlGenerator({
region: 'us-east-1',
credentials: {
accessKeyId: 'YOUR_ACCESS_KEY',
secretAccessKey: 'YOUR_SECRET_KEY',
},
});
// Generate a download URL
const getDownloadUrl = async () => {
try {
const url = await urlGenerator.getDownloadUrl(
'my-bucket',
'path/to/file.pdf'
);
console.log('Download URL:', url);
} catch (error) {
console.error('Error:', error);
}
};
// Generate an upload URL
const getUploadUrl = async () => {
try {
const url = await urlGenerator.getUploadUrl(
'my-bucket',
'path/to/upload.jpg',
'image/jpeg'
);
console.log('Upload URL:', url);
} catch (error) {
console.error('Error:', error);
}
};
// Generate multiple download URLs
const getBatchUrls = async () => {
try {
const urls = await urlGenerator.getBatchDownloadUrls('my-bucket', [
'file1.pdf',
'file2.jpg',
'file3.png',
]);
console.log('Batch URLs:', urls);
} catch (error) {
console.error('Error:', error);
}
};
π License
S3 URL Generator is licensed under the MIT License. See the LICENSE file for details.
π§© Contributing
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch for your feature or fix.
- Commit your changes and submit a pull request.
Check out our contribution guidelines for more details.
Built with β€οΈ by Ridhamz