mirror of
https://github.com/amark/gun.git
synced 2025-11-24 14:35:55 +00:00
👺 Add a .replace() to delete all the “\n’ (#1118)
This commit is contained in:
parent
6cb7261ac2
commit
4db88079b5
@ -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 }
|
||||||
Loading…
x
Reference in New Issue
Block a user