1
0
Fork 0
peertube/server/tests/fixtures/peertube-plugin-test-six/main.js

42 lines
923 B
JavaScript
Raw Normal View History

const fs = require('fs')
const path = require('path')
2020-05-04 03:44:00 -04:00
async function register ({
storageManager,
peertubeHelpers,
getRouter
2020-05-04 03:44:00 -04:00
}) {
const { logger } = peertubeHelpers
{
await storageManager.storeData('superkey', { value: 'toto' })
await storageManager.storeData('anotherkey', { value: 'toto2' })
const result = await storageManager.getData('superkey')
logger.info('superkey stored value is %s', result.value)
}
{
getRouter().get('/create-file', async (req, res) => {
const basePath = peertubeHelpers.plugin.getDataDirectoryPath()
fs.writeFile(path.join(basePath, 'Aladdin.txt'), 'Prince Ali', function (err) {
if (err) return res.sendStatus(500)
res.sendStatus(200)
})
})
}
2020-05-04 03:44:00 -04:00
}
async function unregister () {
return
}
module.exports = {
register,
unregister
}
// ###########################################################################