Code files

This commit is contained in:
Akhil
2017-07-31 11:33:31 +05:30
parent 073a63ebdd
commit b9ae409ec0
801 changed files with 17535 additions and 0 deletions
@@ -0,0 +1,23 @@
'use strict'
setInterval(() => process.stdout.write('.'), 10).unref()
const fs = require('fs')
const path = require('path')
const cwd = process.cwd()
const sbs = require('strip-bytes-stream')
fs.createReadStream(path.join(cwd, 'file.dat'))
.pipe(sbs((n) => n))
.on('end', function () { log(this.total) })
.pipe(fs.createWriteStream(path.join(cwd, 'clean.dat')))
function log(total) {
fs.appendFile(
path.join(cwd, 'log.txt'),
(new Date) + ' ' + total + ' bytes removed\n'
)
}