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

            Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

            Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

            How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page