Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

259
Visualizações
How to use require() in html

I try to use require() in html. I try to use require in JS but I get the following error Uncaught ReferenceError: require is not defined I wonder how can I use require function on client browser. And there is no way to use require in client browser except requireJS??

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 = 'together-image';
const local_file_path = './image.jpg';


(async () => {

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

    object_name = 'image.jpg';

    // upload file
    await S3.putObject({
        Bucket: bucket_name,
        Key: object_name,
        ACL: 'public-read',
        Body: fs.createReadStream(local_file_path)
    }).promise();
})();

I appreciate with your help in advance

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It is not possible unless a module bundler is used. I recommend using aws sdk for browser in https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/getting-started-browser.html

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda