fs.createwritestream is not a function The Next CEO of Stack OverflowIn Node.js, how do I “include” functions from my other files?map function for objects (instead of arrays)how to install node Linux Binaries (.tar.xz) file in ubuntu 14.04create-react-app can not run after install a moduleHow can I download create-react-native-app files manually?merging client and server package.json files into oneGot an error while executing “create-react-app my-app”Module not found: Error: Can't resolve '@material-ui/core/styles' (when deploying to heroku)npm start does not work. I've tried everything. I'm confusedhaving problems running these command VS code to create a react app

What does "Its cash flow is deeply negative" mean?

Grabbing quick drinks

How to make a software documentation "officially" citable?

Why is there a PLL in CPU?

Opposite of a diet

Visit to the USA with ESTA approved before trip to Iran

How do I solve this limit?

How to Reset Passwords on Multiple Websites Easily?

MAZDA 3 2006 (UK) - poor acceleration then takes off at 3250 revs

Was a professor correct to chastise me for writing "Prof. X" rather than "Professor X"?

Horror movie/show or scene where a horse creature opens its mouth really wide and devours a man in a stables

How to start emacs in "nothing" mode (`fundamental-mode`)

Fastest way to shutdown Ubuntu Mate 18.10

How did people program for Consoles with multiple CPUs?

Is the concept of a "numerable" fiber bundle really useful or an empty generalization?

How to write the block matrix in LaTex?

Can the Reverse Gravity spell affect the Meteor Swarm spell?

What does this shorthand mean?

What is the purpose of the Evocation wizard's Potent Cantrip feature?

WOW air has ceased operation, can I get my tickets refunded?

Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?

How to get regions to plot as graphics

Why does standard notation not preserve intervals (visually)

Can I equip Skullclamp on a creature I am sacrificing?



fs.createwritestream is not a function



The Next CEO of Stack OverflowIn Node.js, how do I “include” functions from my other files?map function for objects (instead of arrays)how to install node Linux Binaries (.tar.xz) file in ubuntu 14.04create-react-app can not run after install a moduleHow can I download create-react-native-app files manually?merging client and server package.json files into oneGot an error while executing “create-react-app my-app”Module not found: Error: Can't resolve '@material-ui/core/styles' (when deploying to heroku)npm start does not work. I've tried everything. I'm confusedhaving problems running these command VS code to create a react app










0















I am Trying to develop a react app that help me to download files to my amazon cloud.
For that i used This module




download-file-with-progressbar




Here is my code:



 var dl = require('download-file-with-progressbar');
//-----------Download File-------------------
option =
filename: 'fileName',
dir: os.tmpdir(),
onDone: (info)=>
console.log('done', info);
,
onError: (err) =>
console.log('error', err);
,
onProgress: (curr, total) =>
console.log('progress', (curr / total * 100).toFixed(2) + '%');
,


dd = dl('https://nodejs.org/dist/v6.10.2/node-v6.10.2-linux-x64.tar.gz', this.option);
//-------------------------------------------


It is working fine on nodejs project. But when i used it in a react project(created using 'create-react-app') it produced following error.




TypeError: fs.createWriteStream is not a function




My idea of the project is to create a react app that help to download files to my server or cloud space. how to fix that error.










share|improve this question






















  • Did you install "download-file-with-progressbar" module in react project?

    – Nikola Trajkovic
    Mar 8 at 13:08











  • @James Delaney yes

    – Stv News Kaipamangalam
    Mar 8 at 13:40















0















I am Trying to develop a react app that help me to download files to my amazon cloud.
For that i used This module




download-file-with-progressbar




Here is my code:



 var dl = require('download-file-with-progressbar');
//-----------Download File-------------------
option =
filename: 'fileName',
dir: os.tmpdir(),
onDone: (info)=>
console.log('done', info);
,
onError: (err) =>
console.log('error', err);
,
onProgress: (curr, total) =>
console.log('progress', (curr / total * 100).toFixed(2) + '%');
,


dd = dl('https://nodejs.org/dist/v6.10.2/node-v6.10.2-linux-x64.tar.gz', this.option);
//-------------------------------------------


It is working fine on nodejs project. But when i used it in a react project(created using 'create-react-app') it produced following error.




TypeError: fs.createWriteStream is not a function




My idea of the project is to create a react app that help to download files to my server or cloud space. how to fix that error.










share|improve this question






















  • Did you install "download-file-with-progressbar" module in react project?

    – Nikola Trajkovic
    Mar 8 at 13:08











  • @James Delaney yes

    – Stv News Kaipamangalam
    Mar 8 at 13:40













0












0








0








I am Trying to develop a react app that help me to download files to my amazon cloud.
For that i used This module




download-file-with-progressbar




Here is my code:



 var dl = require('download-file-with-progressbar');
//-----------Download File-------------------
option =
filename: 'fileName',
dir: os.tmpdir(),
onDone: (info)=>
console.log('done', info);
,
onError: (err) =>
console.log('error', err);
,
onProgress: (curr, total) =>
console.log('progress', (curr / total * 100).toFixed(2) + '%');
,


dd = dl('https://nodejs.org/dist/v6.10.2/node-v6.10.2-linux-x64.tar.gz', this.option);
//-------------------------------------------


It is working fine on nodejs project. But when i used it in a react project(created using 'create-react-app') it produced following error.




TypeError: fs.createWriteStream is not a function




My idea of the project is to create a react app that help to download files to my server or cloud space. how to fix that error.










share|improve this question














I am Trying to develop a react app that help me to download files to my amazon cloud.
For that i used This module




download-file-with-progressbar




Here is my code:



 var dl = require('download-file-with-progressbar');
//-----------Download File-------------------
option =
filename: 'fileName',
dir: os.tmpdir(),
onDone: (info)=>
console.log('done', info);
,
onError: (err) =>
console.log('error', err);
,
onProgress: (curr, total) =>
console.log('progress', (curr / total * 100).toFixed(2) + '%');
,


dd = dl('https://nodejs.org/dist/v6.10.2/node-v6.10.2-linux-x64.tar.gz', this.option);
//-------------------------------------------


It is working fine on nodejs project. But when i used it in a react project(created using 'create-react-app') it produced following error.




TypeError: fs.createWriteStream is not a function




My idea of the project is to create a react app that help to download files to my server or cloud space. how to fix that error.







node.js reactjs typeerror createwritestream






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 12:56









Stv News KaipamangalamStv News Kaipamangalam

2812




2812












  • Did you install "download-file-with-progressbar" module in react project?

    – Nikola Trajkovic
    Mar 8 at 13:08











  • @James Delaney yes

    – Stv News Kaipamangalam
    Mar 8 at 13:40

















  • Did you install "download-file-with-progressbar" module in react project?

    – Nikola Trajkovic
    Mar 8 at 13:08











  • @James Delaney yes

    – Stv News Kaipamangalam
    Mar 8 at 13:40
















Did you install "download-file-with-progressbar" module in react project?

– Nikola Trajkovic
Mar 8 at 13:08





Did you install "download-file-with-progressbar" module in react project?

– Nikola Trajkovic
Mar 8 at 13:08













@James Delaney yes

– Stv News Kaipamangalam
Mar 8 at 13:40





@James Delaney yes

– Stv News Kaipamangalam
Mar 8 at 13:40












1 Answer
1






active

oldest

votes


















0














The createWriteStream is a function part of the Nodejs API, that is why it is working fine when you run it as a nodejs project.



But when you run a React app, it is your browser that executes your code and not nodejs. And browsers don't know about this API.



If you want to download a file from a React application, you have to do it through an HTTP request. You can use the fetch API for example.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55063698%2ffs-createwritestream-is-not-a-function%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The createWriteStream is a function part of the Nodejs API, that is why it is working fine when you run it as a nodejs project.



    But when you run a React app, it is your browser that executes your code and not nodejs. And browsers don't know about this API.



    If you want to download a file from a React application, you have to do it through an HTTP request. You can use the fetch API for example.






    share|improve this answer



























      0














      The createWriteStream is a function part of the Nodejs API, that is why it is working fine when you run it as a nodejs project.



      But when you run a React app, it is your browser that executes your code and not nodejs. And browsers don't know about this API.



      If you want to download a file from a React application, you have to do it through an HTTP request. You can use the fetch API for example.






      share|improve this answer

























        0












        0








        0







        The createWriteStream is a function part of the Nodejs API, that is why it is working fine when you run it as a nodejs project.



        But when you run a React app, it is your browser that executes your code and not nodejs. And browsers don't know about this API.



        If you want to download a file from a React application, you have to do it through an HTTP request. You can use the fetch API for example.






        share|improve this answer













        The createWriteStream is a function part of the Nodejs API, that is why it is working fine when you run it as a nodejs project.



        But when you run a React app, it is your browser that executes your code and not nodejs. And browsers don't know about this API.



        If you want to download a file from a React application, you have to do it through an HTTP request. You can use the fetch API for example.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 8 at 13:10









        Arnaud ChristArnaud Christ

        913919




        913919





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55063698%2ffs-createwritestream-is-not-a-function%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

            Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

            2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived