Skip to content

Instantly share code, notes, and snippets.

@probablycorey
Created October 15, 2018 18:52
Show Gist options
  • Save probablycorey/3a673dd08aea886ec3785161d646e46e to your computer and use it in GitHub Desktop.
Save probablycorey/3a673dd08aea886ec3785161d646e46e to your computer and use it in GitHub Desktop.
const memo = require('@atom/memo')
const start = async () => {
try {
const { WorkTree } = await memo.init()
const replicaId = Math.floor(Math.random() * 1000)
const tree = new WorkTree(replicaId)
tree.appendBaseEntries([{ depth: 1, name: 'cats', type: 'Directory' }, { depth: 1, name: 'stinky.txt', type: 'Text' }])
const { fileId } = tree.newTextFile()
const dirname = 'cats'
const parentFileId = tree.fileIdForPath(dirname)
tree.rename(fileId, parentFileId, 'mr-meow.txt')
console.log('It gets here!')
console.log('It fails to run this line :(', tree.getText(fileId))
} catch (error) {
console.error('Failed:', error)
}
}
start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment