4 Replies - 757 Views - Last Post: 07 April 2015 - 03:00 AM

#1 shivampaw   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 80
  • Joined: 13-March 14

node.js ftp string to server and create file.

Posted 06 April 2015 - 08:37 AM

Let's say I have a string that is dynamically created using defined variables. For example:

<html>
   <head>
   .... blah blah blah ....
   </head>

   <body>

    <h1>Clan Name</h1>

  </body>

</html>

The string would be stored as "htmlOutput" and then I need to upload that string to a directory on a web-server using a variable as the file-name. For example the file-name might be 495731951.html

Another thing is that the file might need to be overwritten when there is a newer version with the same file name ready to be uploaded.


How is this achieved?

I've had a look at jsftp but there's nothing for uploading the strings value. I don't want to have to create a new file on the local machine for each file as there will be a lot of files.

Thank you!

Is This A Good Question/Topic? 0
  • +

Replies To: node.js ftp string to server and create file.

#2 ArtificialSoldier   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2030
  • View blog
  • Posts: 6,196
  • Joined: 15-January 14

Re: node.js ftp string to server and create file.

Posted 06 April 2015 - 10:50 AM

Quote

I don't want to have to create a new file on the local machine for each file as there will be a lot of files.

Why does that matter? Create a temporary file, save the data, upload the file, and delete it. Repeat for each file.
Was This Post Helpful? 0
  • +
  • -

#3 shivampaw   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 80
  • Joined: 13-March 14

Re: node.js ftp string to server and create file.

Posted 06 April 2015 - 11:01 AM

Ok.

Should I use jsftp? And does the .put command overwrite files if they are already on the server?

This post has been edited by Dormilich: 07 April 2015 - 02:53 AM

Was This Post Helpful? 0
  • +
  • -

#4 ArtificialSoldier   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2030
  • View blog
  • Posts: 6,196
  • Joined: 15-January 14

Re: node.js ftp string to server and create file.

Posted 06 April 2015 - 11:02 AM

I'm not familiar enough with node.js to suggest a specific module. I would imaging that the put command would overwrite something that is already there.
Was This Post Helpful? 0
  • +
  • -

#5 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4202
  • View blog
  • Posts: 13,275
  • Joined: 08-June 10

Re: node.js ftp string to server and create file.

Posted 07 April 2015 - 03:00 AM

Quote

And does the .put command overwrite files if they are already on the server?

that depends on what you code it to do. Node.js is the server. it does what you tell it to do.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1