2017-07-31 11:33:31 +05:30

16 lines
365 B
JavaScript

'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'
)