👺 Add a .replace() to delete all the “\n’ (#1118)

This commit is contained in:
Hector 2021-08-24 11:18:06 +02:00 committed by GitHub
parent 6cb7261ac2
commit 4db88079b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,13 +28,13 @@ function watch(what, opt) {
.on('add', async function(path) { .on('add', async function(path) {
log(`File ${path} has been added`); log(`File ${path} has been added`);
gun.get('hub').get(modifiedPath + '/' + path).put(fs.readFileSync(path, 'utf-8')) gun.get('hub').get(modifiedPath + '/' + path).put(fs.readFileSync(path, 'utf-8').replace(/\n/gm, ""))
}) })
.on('change', async function(path) { .on('change', async function(path) {
log(`File ${path} has been changed`); log(`File ${path} has been changed`);
gun.get('hub').get(modifiedPath + '/' + path).put(fs.readFileSync(path, 'utf-8')) gun.get('hub').get(modifiedPath + '/' + path).put(fs.readFileSync(path, 'utf-8').replace(/\n/gm, ""))
}) })
.on('unlink', async function (path) { .on('unlink', async function (path) {
@ -53,8 +53,4 @@ function watch(what, opt) {
} }
} }
gun.get('hub').on(data => {
console.log(data);
})
module.exports = { watch : watch } module.exports = { watch : watch }