• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

338
Vistas
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);
    });
about 3 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda