Code files
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const cwd = process.cwd()
|
||||
const bytes = fs.readFileSync(path.join(cwd, 'file.dat'))
|
||||
|
||||
const clean = bytes.filter(n => n)
|
||||
fs.writeFileSync(path.join(cwd, 'clean.dat'), clean)
|
||||
|
||||
fs.appendFileSync(
|
||||
path.join(cwd, 'log.txt'),
|
||||
(new Date) + ' ' + (bytes.length - clean.length) + ' bytes removed\n'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user