attempt at implementing /dev/random
This commit is contained in:
parent
993723865d
commit
c50949576b
|
@ -3,6 +3,21 @@ fs.writeFileSync('README.md', 'uwu');
|
||||||
const { ufs } = require('unionfs');
|
const { ufs } = require('unionfs');
|
||||||
|
|
||||||
ufs.use(fs).use(vol.fromJSON(require('./files')));
|
ufs.use(fs).use(vol.fromJSON(require('./files')));
|
||||||
ufs.constants = fs.constants;
|
|
||||||
|
if (!fs.existsSync('dev'))
|
||||||
|
fs.mkdirSync('dev');
|
||||||
|
|
||||||
|
// /dev/random & /dev/random
|
||||||
|
(async () => {
|
||||||
|
const delay = t => new Promise(resolve => setTimeout(resolve, t));;
|
||||||
|
const crypto = require('crypto');
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
await delay(3);
|
||||||
|
const buffer = crypto.randomBytes(16);
|
||||||
|
fs.writeFileSync('dev/urandom', buffer);
|
||||||
|
fs.writeFileSync('dev/random', buffer)
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
module.exports = ufs;
|
module.exports = ufs;
|
Loading…
Reference in New Issue