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

212
Visualizações
with open(image.png,"rb") as f: in typescript?

How to open png files like method : with open(path+im,"rb") as f: of python but in typescript? If I have a folder that contain some png and i want to read and convert them to base 64 in python i use that method but which is the corrispective method in typescript? Can sameone help me please?

I have this code in python :

def image_integrity():
    list_of_sha256 = []
    path = "./nft_test/"
    for im in os.listdir(path):
        with open(path+im,"rb") as f:
            f = base64.b64encode(f.read()) # read entire file as bytes
            h = hashlib.new("sha256")
            h.update(f)
            result = h.digest()
            result = base64.b64encode(result).decode("utf-8")
            print(result)
            list_of_sha256.append(result)
    return list_of_sha256

and I want to rewrite it in typescript.

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

0

seems you are want read from dir.

fs.readFile( path.resolve(__dirname, './data.txt' ), 'utf-8', function(err, buf) 
{
    var data= buf.toString();
    console.log('load', 'OK'.green);
});
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