# Node-red-contrib-ftp-server

**URL:** <https://discourse.nodered.org/t/node-red-contrib-ftp-server/56596>\
**Category:** General\
**Created:** [13 January 2022 14:09 UTC](https://discourse.nodered.org/t/node-red-contrib-ftp-server/56596 "2022-01-13T14:09:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [13 January 2022 14:09 UTC](https://discourse.nodered.org/t/node-red-contrib-ftp-server/56596/1 "2022-01-13T14:09:30Z")

</div>

I'm trying to create an FTP server with Node Red on the `node-red-contrib-ftp-server` where its working. The screen shot below is the ftp node ingesting some data I sent to the Node Red server via FT.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/4/845ca837eefbadc8bc7f40ab221da95355e89ea4.png)

The debug for the what the data looks like is a confusing, highlighted yellow on the right hand side above.

Ultimately this is what the data file looks like in Excel:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e75198907b6951d7c3feb4b7dce25612adfc9e9c.png)

Can someone help me understand:

- Do I need a JavaScript function block to recreate the data structure of the csv file? Its time series data of an electric meter

- 
  1. Would anyone have tips for saving the data? I dont know a lot about data bases, is there any easy one to work with for the newbie? What I am hoping for is to find some solution that I can implement where an electric meter csv file will get uploaded via ftp to the Node Red ftp server ONCE PER DAY (or something similar) and the data can be continuously appended to a database; where then on some future date I can retrieve the data on hopefully somewhat of an easy process.

Any help and tips, links to tutorials greatly appreciated. I don't have a ton of JavaScript experience.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [13 January 2022 14:13 UTC](https://discourse.nodered.org/t/node-red-contrib-ftp-server/56596/2 "2022-01-13T14:13:29Z")

</div>

The buffer is probably the binary content of the file.

You can convert it to a string in a function node using

```auto
msg.payload = msg.payload.toString();
return msg;

```

Then you can feed it to a CSV node to covert the text to usable objects.

Connect a debug node to every node to see how the data changes as it passes through the nodes.

Once you have that, search the forum and flows library for database examples - there are LOTS of them

---

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [13 January 2022 14:20 UTC](https://discourse.nodered.org/t/node-red-contrib-ftp-server/56596/3 "2022-01-13T14:20:23Z")

</div>

> [@Steve-Mcl](#):
>
> ```auto
> msg.payload = msg.payload.toString();
> return msg;
> 
> ```

Thanks Steve that worked perfect to convert to string.

---

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [13 January 2022 15:57 UTC](https://discourse.nodered.org/t/node-red-contrib-ftp-server/56596/4 "2022-01-13T15:57:30Z")

</div>

@Steve-Mcl on Ubuntu would you know where the node red `static` directory would be located?

There's a [YouTube video](https://www.youtube.com/watch?v=_PNhLYj8INs) where I can append CSV files and serve them through the node red `static` directory and retrieve the CSV data through the browser which will work great for now but I am having a difficult time trying to find where the static directory exists.

I can access the `settings.js` no problem here `ben@ben-HP-ProBook-6550b:~/.node-red$`

When I can nano `settings.js` I did uncomment out:

httpStatic: '/home/nol/node-red-static/'

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/1/1147862712e4c3f42593b1b9e0eeffca00ad0059.png)

But the only thing that exists in `/home` is:

```auto
ben@ben-HP-ProBook-6550b:/home$ ls
ben

```

No `nol` directory, any ideas to try?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [13 January 2022 16:09 UTC](https://discourse.nodered.org/t/node-red-contrib-ftp-server/56596/5 "2022-01-13T16:09:06Z")

</div>

The directory is any directory that exists on your device. Often a sub folder of .node-red but it's up to you. For example, if you create a directory node-red folder called `/home/ben/node-red-static` then that's what it'll be.

Can't think of any other way to explain it does that make sense?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 January 2022 16:09 UTC](https://discourse.nodered.org/t/node-red-contrib-ftp-server/56596/6 "2022-01-27T16:09:51Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
