Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

323
Vistas
Upload a image to Microsoft Azure Blob Storage with node js

I am trying to upload a image to my blob storage but it upload text of the file path instead of image


const { BlobServiceClient, StorageSharedKeyCredential } = require("@azure/storage-blob");


const account = "<account name hided";
const accountKey = "<key hided>";

const sharedKeyCredential = new StorageSharedKeyCredential(account, accountKey);
const blobServiceClient = new BlobServiceClient(
    `https://${account}.blob.core.windows.net`,
    sharedKeyCredential
);


var containerName = 'democontainer1';

async function createContainer() {
    const containerClient = blobServiceClient.getContainerClient(containerName);

    var blobName = "newblob" + new Date().getTime();
    var filePath = "./newblob.jpg";

    const blockBlobClient = containerClient.getBlockBlobClient(blobName);

    const uploadBlobResponse = await blockBlobClient.upload(filePath, filePath.length);
    console.log(`Upload block blob ${blobName} successfully`, uploadBlobResponse.requestId);
}

createContainer();

I want like this :

enter image description here

But the output is :

img

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Please change the following line of code:

const uploadBlobResponse = await blockBlobClient.upload(filePath, filePath.length);

to

const uploadBlobResponse = await blockBlobClient.uploadFile(filePath);

and you should see proper blob being uploaded.

about 4 years ago · Juan Pablo Isaza Denunciar
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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda