Skip to main content
Version: 1.0

File sharing

You can try by running this code at your console:

deno run https://mega.js.org/demos/sharing-demo.js
import { getLoggedInStorage } from './logging-in-demo.js'
const storage = await getLoggedInStorage()

console.log('Choose one of the following files or folders:')
console.log(storage.root.children.map(e => e.name))

const filename = prompt('Enter a file name (case sensitive):')
const file = storage.find(filename)
if (!file) throw Error('File not found!')

const link = await file.link()
console.log(link)