I've been using https://github.com/patrickjuchli/basic-ftp
There code that I've been working on, and have a problem with using the upload.
the standard code is
await client.upload(fs.createReadStream("README.md"), "README.md")
the README.md
on fs.createReadStream("README.md")
is the file that is already at the directory
but on the code that I'm working on is generated on the javascript like this:
const os = require('os');
const output = []
const data = [{subject:'Math', grade: 85},{subject:'Art', grade: 80},..]
data.forEach((d) => {
output.push(
d.subject+ "\t"
+ d.grade+ "\n");
});
var dataTXT = output.join(os.EOL);
await client.upload(dataTXT , "filename.txt")
the problem is, the file that is sent was empty.
is there another way of implementing it, or I have to use fs.createReadStream
but there is no file/data that is can provide because is still on the code.
And I can't do fs.writeFile
because of this code will be launch of a server later on.