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

397
Views
How to delete files within a folder from digitalocean in node.js

I can upload a file within a folder in digitalocean spaces using the AWS SDK using the following:

const params = {
        Bucket: "my-bucket-name",
        Key: "test/" + 'sample.png',
        Body: image.data,
    };
    s3.putObject({ ...params, ACL: "public-read" }, (err, data) => {
        if (err) console.log(err);
        else console.log(data);
    });

Now I want to delete the file 'sample.png' without deleting the folder 'test' from the space. I tried the following snippet which deletes the entire folder:

const params = {
        Bucket: "my-bucket-name",
        Key: "test/sample.png",
    };

    s3.deleteObject({ ...params }, (err, data) => {
        if (err) console.log(err);
        else console.log(data);
    });
over 4 years ago · Santiago Trujillo
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!