Last active
August 29, 2015 14:10
-
-
Save mafintosh/ed86074dfb6354165fd6 to your computer and use it in GitHub Desktop.
index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// do `docker pull mafintosh/bulk-markdown-to-png` first | |
var Dat = require('dat') | |
var pretty = require('pretty-bytes') | |
var run = require('docker-run') | |
var tar = require('tar-stream') | |
var dat = new Dat('./', function(err) { | |
if (err) throw err // yolo | |
var totalSize = 0 | |
dat.createReadStream({gte:'dat', limit:1}) | |
.on('data', function(data) { | |
var b = run('mafintosh/bulk-markdown-to-png') | |
var e = tar.extract() | |
b.stdin.write(JSON.stringify(data)+'\n') | |
b.stdout.pipe(e) | |
e.on('entry', function(header, stream, next) { | |
var bl = dat.createBlobWriteStream( | |
header.name, | |
data, | |
function() { | |
console.log('i have added a blob') | |
}) | |
stream.pipe(bl) | |
}) | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Dat = require('dat') | |
var pretty = require('pretty-bytes') | |
var bulk = require('bulk-markdown-to-png') | |
var tar = require('tar-stream') | |
var dat = new Dat('./', function(err) { | |
if (err) throw err // yolo | |
var totalSize = 0 | |
dat.createReadStream({gte:'dat', limit:1}) | |
.on('data', function(data) { | |
var b = bulk() | |
var e = tar.extract() | |
b.write(JSON.stringify(data)+'\n') | |
b.pipe(e) | |
e.on('entry', function(header, stream, next) { | |
var bl = dat.createBlobWriteStream( | |
header.name, | |
data, | |
function() { | |
console.log('i have added a blob') | |
}) | |
stream.pipe(bl) | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment