View gist:ce29ec1843992cd38d231ef87b5c78a9
# all times are in ms
# downloads.tar is my downloads folder, which is gigantic because i'm lazy
# and never delete anything out of it.
$ ls -laF downloads.tar
-rw-r--r-- 1 isaacs staff 6552657408 Mar 23 23:54 downloads.tar
# read synchronously and writes to an extractor that does all sync fs operations
$ node es-sync2.js downloads.tar
13734.368
# 13.7s, not bad
View no-parse.js
$ for TEST in old.js ts.js np3.js np3-seek.js np3-ignore.js no-parse.js; do echo ""; echo $TEST; for i in {1..5}; do node $TEST test/fixtures.tar >/dev/null; done; done
old.js
24.48
25.71
25.696
26.064
24.163
ts.js
View jsonar.md

JSONar

A highly compressible, appendable, indexed, fast-parsing, flexible, extensible, human-debuggable, machine-verifiable, tamper-resistant archive format.

JSONar takes some of the best parts of tar, without also being a forensic history of computing.

Entries

View servers.js
const http = require('http')
const firstServer = http.createServer((req, res) => {
console.log('firstServer request', req.url, req.headers)
res.setHeader('set-cookie', 'foo=bar; max-age=10000000; host=localhost:8080; SameSite=Strict')
res.setHeader('content-type', 'text/html')
res.write('<pre>')
res.write(JSON.stringify(req.headers, null, 2) + '\n')
View npm-keybase-proof.sh
#!/bin/bash
set -e
# create keybase-proof folder
mkdir -p keybase-proof
cd keybase-proof
NAME=$(npm whoami -s || true)
View new node tar and fs-readstream-seek
$ find test -name *.tar | while read tar; do time node nps.js $tar; done
< "test/dir-normalization.tar"
fixtures/
Directory
mode=0755 user=isaacs group=staff mtime=2015-04-09T00:14:36.000Z
fixtures/a/
Directory
mode=0755 user=isaacs group=staff mtime=2015-04-09T00:13:20.000Z
View gist:382d398d6542191bfeee779bc0c12e29
$ find test -name *.tar | while read tar; do time node nps.js $tar; done
fixtures/
Directory
mode=0755 user=isaacs group=staff mtime=2015-04-09T00:14:36.000Z
fixtures/a/
Directory
mode=0755 user=isaacs group=staff mtime=2015-04-09T00:13:20.000Z
fixtures/the-chumbler@ -> /a/b/c/d/the-chumbler
View double-wrap.js
var sw = require('spawn-wrap')
var argv = process.argv.slice(1).map(function (arg) {
if (arg === __filename)
arg = 'double-wrap.js'
return arg
})
var node = process.execPath
var fg = require('foreground-child')
View examples-array-ify.js
// testing converting arguments to an Array
function manualMap () {
var l = arguments.length
var arr = new Array(l)
for (var i = 0; i < l; i ++) arr[i] = arguments[i]
return arr
}
function manualMapArg (x) {
View p.js
var sax = require('./')
var parser = sax.parser()
var xml = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36.223 36.223"><title>playbtn</title><path d="M31.957,16.943,5.689,1.777A1.422,1.422,0,0,0,3.555,3.009V33.341a1.422,1.422,0,0,0,2.133,1.232L31.957,19.407a1.422,1.422,0,0,0,0-2.463Z" style="fill:#fff"/></svg>
`
sax.EVENTS.forEach(ev => {
parser['on' + ev] = data => {
console.log('%s %j', ev, data)
}