-
-
Save probablycorey/3a673dd08aea886ec3785161d646e46e to your computer and use it in GitHub Desktop.
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
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