0

I'm currently working on a script that collects specific data and my end goal is to fetch this data as csv file?

I've tried many different methods, but everything leads to having a frontend. I want my script to download only using cmd without having any frontend, is that even possible?

Fill
  • 377
  • 2
  • 15
  • You've tagged JavaScript and seem to be wanting to run JS on a server without a UI. Have you taken a look at [NodeJS](https://nodejs.org/)? – phuzi Jun 28 '22 at 13:14
  • @phuzi I'm running a JS file that has a specific script that fetches data on `npm start` command in shell, I would like to including `csv download` in that script as well – Fill Jun 28 '22 at 13:16
  • Can you explain "I've tried many different methods, but everything leads to having a frontend"? – phuzi Jun 28 '22 at 13:17
  • @phuzi most of the answers I've found require a frontend method that includes fetching data via `window` command, that I assume can not be achieved without frontend – Fill Jun 28 '22 at 13:18
  • Yeah, `window` is browser specific. – phuzi Jun 28 '22 at 13:26
  • @phuzi so is there a way to download without browser? – Fill Jun 28 '22 at 13:26
  • @phuzi I believe it is. But that means it's not possible without running `nodejs`? – Fill Jun 28 '22 at 13:31
  • curl for windows maybe? – iLuvLogix Jun 28 '22 at 13:32
  • Yeah, as JavaScript is an interpreted language it is normally run within a host environment like the browser. Node is such an environment that makes it possible to run JavaScript outside of the browser on a server without a UI/Frontend – phuzi Jun 28 '22 at 13:33
  • @phuzi but my JS runs perfectly without Node environment so far, my only issue is downloading the file. But I believe you're right and I would just need to insert my script into NodeJS server sided file. – Fill Jun 28 '22 at 13:37
  • How are you running it currently? – phuzi Jun 28 '22 at 13:41
  • @phuzi simply `npm start` and specific `js` runs the functions that I require it to fetch data from API. Now I have data, that is being displayed in my `cmd`. My next step to download this data instead of showing it in `cmd` – Fill Jun 28 '22 at 13:42
  • 1
    npm as in Node Package Manager, sounds like you're already running under Node :o) – phuzi Jun 28 '22 at 13:44
  • @phuzi cheers Im stupid :D – Fill Jun 28 '22 at 13:48
  • Not sure what you mean by "*without having any frontend*" - it sounds like you have a backend, which is a webserver serving files, no? If you don't want to use a web (http) server, you can also use an ftp server or a smb or a ssh server. – Bergi Jun 28 '22 at 14:12
  • Why is this tagged [javascript]? – Bergi Jun 28 '22 at 14:13

0 Answers0