Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Save users to txt file

creator: caztspace

thx for you coding!


How to use

download the project, install the corresponding dependencies, run the following command:

npm run dev

And open in your browser the localhost:4000.


a web site to save usernames in txt files, allows you to download this log and delete it when you see fit.

usinf "fs" library for write, delete and update txt file.

npm install fs

const fs = require('fs');
const express = require('express');
const fs = require('fs');
const query = express();

const write = query.post('/file', (req, res) => {
    
    datos = req.body
    let name = 'user: ' + datos.user 
    let pass = 'password: ' + datos.pass

    if (datos.user == '' || datos.pass == ''){
        console.log('void');
    } else {
        fs.appendFile('./src/info.txt', '\n' + name + '\n' + pass + '\n', (err) => {
            if (err) {
                console.log(err);
            }

            const users = fs.readFileSync('./src/info.txt', 'utf-8')
            const lines = users.split('\n')
            for (const line of lines){
                console.log(line);
            }
            res.redirect('/');
        })
    }
    
})

module.exports = write;

Normal:

Captura de pantalla 2023-08-16 210732

If the fields are empty:

Captura de pantalla 2023-08-16 210750

About

a web site to save usernames in txt files, allows you to download this log and delete it when you see fit. usinf "fs" library for write, delete and update txt file.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages