MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    node_helper - using fs or request?

    Scheduled Pinned Locked Moved Development
    5 Posts 3 Posters 1.5k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • yawnsY Offline
      yawns Moderator
      last edited by

      Hi guys,

      for one module currently requested I have to load a csv file with ~100kb and lots of content sitting inside the module folder.
      What do you think is more performant? Using request reading the file from “localhost” or using fs.readFile? Does it make any difference?

      Best regards,
      Stefan

      S 2 Replies Last reply Reply Quote 0
      • S Offline
        sdetweil @yawns
        last edited by

        @yawns for such a small set of work, either is about the same…

        if u were doing this 20 times/second over hours, i might use the fs approach, but it depends on what you want to do with it later…

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 1
        • S Offline
          sdetweil @yawns
          last edited by

          @yawns but… using the request approach would insulate you from changes needed to use a remote location source…

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          yawnsY 1 Reply Last reply Reply Quote 1
          • yawnsY Offline
            yawns Moderator @sdetweil
            last edited by

            @sdetweil said in node_helper - using fs or request?:

            @yawns but… using the request approach would insulate you from changes needed to use a remote location source…

            That’s a valid point, yes. I doubt this will be necessary or possible, but you never know. If it makes no difference in performance I will stick with the request.
            Thanks for your thoughts, Sam. Very much appreciated

            ? 1 Reply Last reply Reply Quote 0
            • ? Offline
              A Former User @yawns
              last edited by

              @yawns
              I think performance of ‘fs’ is absolutely faster than ‘request’.

              1 Reply Last reply Reply Quote 1
              • 1 / 1
              • First post
                Last post
              Enjoying MagicMirror? Please consider a donation!
              MagicMirror created by Michael Teeuw.
              Forum managed by Sam, technical setup by Karsten.
              This forum is using NodeBB as its core | Contributors
              Contact | Privacy Policy