Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

[FEATURE] Support Storj S3 host #172

Closed
tycrek opened this issue Nov 18, 2022 · 3 comments
Closed

[FEATURE] Support Storj S3 host #172

tycrek opened this issue Nov 18, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@tycrek
Copy link
Owner

tycrek commented Nov 18, 2022

Description

Storj is an affordable high-performance S3 host. Many users could benefit from compatibility.

@tycrek tycrek added the enhancement New feature or request label Nov 18, 2022
@tycrek tycrek self-assigned this Nov 18, 2022
@nischay876
Copy link
Contributor

nischay876 commented Nov 18, 2022

https://aws.amazon.com/blogs/developer/generate-presigned-url-modular-aws-sdk-javascript/
https://stackoverflow.com/questions/38831829/nodejs-aws-sdk-s3-generate-presigned-url

Example 1
import { HttpRequest } from "@aws-sdk/protocol-http";
import { S3RequestPresigner } from "@aws-sdk/s3-request-presigner";
import { parseUrl } from "@aws-sdk/url-parser";
import { Sha256 } from "@aws-crypto/sha256-browser";
import { Hash } from "@aws-sdk/hash-node";
import { formatUrl } from "@aws-sdk/util-format-url";
// ...
const s3ObjectUrl = parseUrl(`https://${bucket}.s3.${region}.amazonaws.com/${key}`);
const presigner = new S3RequestPresigner({
    credentials,
    region,
    sha256: Hash.bind(null, "sha256"), // In Node.js
    //sha256: Sha256 // In browsers
});
// Create a GET request from S3 url.
const url = await presigner.presign(new HttpRequest(s3ObjectUrl));
console.log("PRESIGNED URL: ", formatUrl(url));
Example 2
    AWS.config.update({ 
        accessKeyId: ':)))',
        secretAccessKey: ':DDDD',
        region: 'ap-south-1',
        signatureVersion: 'v4'
    });
    const s3 = new AWS.S3()
    const myBucket = ':)))))'
    const myKey = ':DDDDDD'
    const signedUrlExpireSeconds = 60 * 5

    const url = s3.getSignedUrl('getObject', {
        Bucket: myBucket,
        Key: myKey,
        Expires: signedUrlExpireSeconds
    });
    console.log(url);

@nischay876
Copy link
Contributor

nischay876@6c03fce

@tycrek
Copy link
Owner Author

tycrek commented Jul 7, 2023

Planning for 0.15.0. Closing this issue in favor of #216

@tycrek tycrek closed this as completed Jul 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants