16 lines
421 B
JavaScript
16 lines
421 B
JavaScript
'use strict'
|
|
|
|
setInterval(() => process.stdout.write('.'), 10).unref()
|
|
|
|
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'
|
|
) |