Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!