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

191
Views
Download File from URL javascript and Remain itself as orginal file name

I have code where I can download the file form URL but I need the file to have the same name as per original file name where it was uploaded

  const downloadImage = () => {
  var http = require("http"),
  Stream = require("stream").Transform,
  fs = require("fs");

  var url = "http://cutt.ly/0JCQfSh";

  http
    .request(url, function (response) {
      var data = new Stream();

      response.on("data", function (chunk) {
        data.push(chunk);
      });

      response.on("end", function () {
        fs.writeFileSync('image.png', data.read());
      });
    })
    .end();
};

Open the URL Link on the browser and check the file name its Asset0.png. I want to download a file with the same name

about 4 years ago · Juan Pablo Isaza
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!