Skip to content

Instantly share code, notes, and snippets.

@mafintosh
Last active August 29, 2015 14:10
Show Gist options
  • Save mafintosh/ed86074dfb6354165fd6 to your computer and use it in GitHub Desktop.
Save mafintosh/ed86074dfb6354165fd6 to your computer and use it in GitHub Desktop.
index.js
// 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)
})
})
})
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