Code files
This commit is contained in:
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
Wed Jun 08 2016 22:53:26 GMT+0100 (BST) 896961 bytes removed
|
||||
Wed Jun 08 2016 22:54:14 GMT+0100 (BST) 896961 bytes removed
|
||||
Wed Jun 08 2016 22:54:25 GMT+0100 (BST) 896961 bytes removed
|
||||
Wed Jun 08 2016 22:54:30 GMT+0100 (BST) 896961 bytes removed
|
||||
Wed Jun 08 2016 22:54:36 GMT+0100 (BST) 896961 bytes removed
|
||||
Wed Jun 08 2016 22:54:41 GMT+0100 (BST) 896961 bytes removed
|
||||
Wed Jun 08 2016 22:54:59 GMT+0100 (BST) 10000000 bytes removed
|
||||
Wed Jun 08 2016 22:56:01 GMT+0100 (BST) 100000000 bytes removed
|
||||
Wed Jun 08 2016 22:57:07 GMT+0100 (BST) 897494 bytes removed
|
||||
Wed Jun 08 2016 22:57:23 GMT+0100 (BST) 10000000 bytes removed
|
||||
Wed Jun 08 2016 22:57:32 GMT+0100 (BST) 897432 bytes removed
|
||||
Wed Jun 08 2016 22:57:34 GMT+0100 (BST) 897432 bytes removed
|
||||
Wed Jun 08 2016 22:57:35 GMT+0100 (BST) 897432 bytes removed
|
||||
Wed Jun 08 2016 22:58:21 GMT+0100 (BST) 897432 bytes removed
|
||||
Wed Jun 08 2016 22:59:03 GMT+0100 (BST) 897432 bytes removed
|
||||
Wed Jun 08 2016 23:03:21 GMT+0100 (BST) 897432 bytes removed
|
||||
Wed Jun 08 2016 23:03:56 GMT+0100 (BST) 897432 bytes removed
|
||||
Wed Jun 08 2016 23:04:14 GMT+0100 (BST) 897432 bytes removed
|
||||
Wed Jun 08 2016 23:04:40 GMT+0100 (BST) 897432 bytes removed
|
||||
Wed Jun 08 2016 23:04:45 GMT+0100 (BST) 897432 bytes removed
|
||||
Wed Jun 08 2016 23:50:48 GMT+0100 (BST) 897432 bytes removed
|
||||
Wed Jun 08 2016 23:50:50 GMT+0100 (BST) 897432 bytes removed
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
'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'
|
||||
)
|
||||
@@ -0,0 +1,19 @@
|
||||
'use strict'
|
||||
|
||||
setInterval(() => process.stdout.write('.'), 10).unref()
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const cwd = process.cwd()
|
||||
|
||||
fs.readFile(path.join(cwd, 'file.dat'), (err, bytes) => {
|
||||
if (err) { console.error(err); process.exit(1); }
|
||||
const clean = bytes.filter(n => n)
|
||||
fs.writeFile(path.join(cwd, 'clean.dat'), clean, (err) => {
|
||||
if (err) { console.error(err); process.exit(1); }
|
||||
fs.appendFile(
|
||||
path.join(cwd, 'log.txt'),
|
||||
(new Date) + ' ' + (bytes.length - clean.length) + ' bytes removed\n'
|
||||
)
|
||||
})
|
||||
})
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
Wed Jun 08 2016 23:48:13 GMT+0100 (BST) 896977 bytes removed
|
||||
Wed Jun 08 2016 23:48:17 GMT+0100 (BST) 896977 bytes removed
|
||||
Wed Jun 08 2016 23:49:25 GMT+0100 (BST) 896977 bytes removed
|
||||
Wed Jun 08 2016 23:50:17 GMT+0100 (BST) 896977 bytes removed
|
||||
@@ -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'
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "piping",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "null-byte-remover.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "David Mark Clements",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"strip-bytes-stream": "^1.1.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
Wed Jun 08 2016 22:56:41 GMT+0100 (BST) 100000000 bytes removed
|
||||
Wed Jun 08 2016 22:56:54 GMT+0100 (BST) 897090 bytes removed
|
||||
Wed Jun 08 2016 22:58:02 GMT+0100 (BST) 897090 bytes removed
|
||||
Wed Jun 08 2016 22:58:03 GMT+0100 (BST) 897090 bytes removed
|
||||
Wed Jun 08 2016 22:58:15 GMT+0100 (BST) 897090 bytes removed
|
||||
Wed Jun 08 2016 22:59:08 GMT+0100 (BST) 897090 bytes removed
|
||||
@@ -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