Click here to Skip to main content
14,693,821 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good day, Please i am new to javascript and i want to save the results calculated on an html in a text file using javascript.
i don't really know how to implement it.
The webpage has java code calculate some numbers and before displaying it in page it has 'return' in its code so i put my lame code before it and some times it displays well while sometimes the page just shows blank.
Please what i want to do is for the website to save all results in a text file. that is it appends to the file.
My code is not correct i know because i am just new to it. so should i place it before the return command in the code?

What I have tried:

const dir = dirname('C:/Users/user/Desktop/WOW');

  if (!existsSync(dir)) {
    mkdirSync(dir, { recursive: true });
    core.debug(`Created directory: ${dir}`);
  }
var jj = sa + p(trimmed) + ea + " ".repeat(addr.length-trimmed.length);
const fs = require('fs')
const filePath = 'file.txt'
 fs.appendFile(filePath, jj, (err) => {
  })
Posted
Updated 3-Apr-20 23:17pm
v2
Comments
Richard MacCutchan 4-Apr-20 4:05am
   
You cannot access the client file system from Javascript.

1 solution

JavaScript do not have access to client file system, it is for security/safety reasons.
Access to client file system is a dream feature for any malware.
What is possible is local storage, it is a protected storage space which does not expose client file system.
HTML Web Storage[^]
   
Comments
MadMyche 4-Apr-20 9:17am
   
+5
Patrice T 4-Apr-20 9:51am
   
Thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900