Skip to content

Instantly share code, notes, and snippets.

@juliangruber
Created January 26, 2018 10:19
Show Gist options
  • Save juliangruber/1298d38a991748284e2745a3642d8f7d to your computer and use it in GitHub Desktop.
Save juliangruber/1298d38a991748284e2745a3642d8f7d to your computer and use it in GitHub Desktop.
const fs = require('fs')
const src = `/tmp/${Math.random()}`
Dat(src, (err, dat) => {
if (err) throw err
dat.archive.writeFile('/dat.json', 'hi', err => {
if (err) throw err
console.log(fs.readFileSync(`${src}/dat.json`)) // => empty
dat.archive.readFile('/dat.json', (err, data) => {
if (err) throw err // => error (couldn't satisfy length)
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment