Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

프로필 사진 API #81

Open
BaeJ1H021 opened this issue Nov 20, 2023 · 0 comments
Open

프로필 사진 API #81

BaeJ1H021 opened this issue Nov 20, 2023 · 0 comments
Assignees
Labels
BE 백엔드 관련 이슈 FE 프론트엔드 관련 이슈

Comments

@BaeJ1H021
Copy link
Collaborator

BaeJ1H021 commented Nov 20, 2023

참고자료

NCP 공식문서

AWS 공식문서

블로그

aws S3 sdk를 쓰긴하지만 NCP bucket에 올라가기 때문에
https://guide.ncloud-docs.com/docs/storage-storage-8-4 이 문서를 참고하는게 좋아보임

const AWS = require('aws-sdk');
const fs = require('fs');
const endpoint = new AWS.Endpoint('https://kr.object.ncloudstorage.com');
const region = 'kr-standard';
const access_key = 'ACCESS_KEY';
const secret_key = 'SECRET_KEY';


const S3 = new AWS.S3({
    endpoint: endpoint,
    region: region,
    credentials: {
        accessKeyId : access_key,
        secretAccessKey: secret_key
    }
});


const bucket_name = 'sample-bucket';
const local_file_path = '/tmp/test.txt';



(async () => {

    let object_name = 'sample-folder/';
    // create folder
    await S3.putObject({
        Bucket: bucket_name,
        Key: object_name
    }).promise();

    object_name = 'sample-object';

    // upload file
    await S3.putObject({
        Bucket: bucket_name,
        Key: object_name,
        ACL: 'public-read',
        // ACL을 지우면 전체 공개되지 않습니다.
        Body: fs.createReadStream(local_file_path)
    }).promise();

})();

S3.putObject 함수가 아닌 presigned url 만드는 방법

@BaeJ1H021 BaeJ1H021 added the BE 백엔드 관련 이슈 label Nov 20, 2023
@seungy0 seungy0 added the FE 프론트엔드 관련 이슈 label Nov 27, 2023
@seungy0 seungy0 added BE 백엔드 관련 이슈 and removed BE 백엔드 관련 이슈 FE 프론트엔드 관련 이슈 labels Nov 27, 2023
@seungy0 seungy0 added the FE 프론트엔드 관련 이슈 label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE 백엔드 관련 이슈 FE 프론트엔드 관련 이슈
Projects
Status: Sprint Backlog
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants