git ssb

0+

cel-desktop / ssb-pkg



Tree: 4c58f1c6c3ddb86a97f27f0c84681d201ef1f75f

Files: 4c58f1c6c3ddb86a97f27f0c84681d201ef1f75f / test / test-50-promisify / test-x-index.js

649 bytesRaw
1'use strict';
2
3var promisify = require('util').promisify;
4if (!promisify) return console.log('ok');
5
6var fs = require('fs');
7var execAsync = promisify(require('child_process').exec);
8var existsAsync = promisify(fs.exists);
9var readAsync = promisify(fs.read);
10
11execAsync('whoami').then(function (output) {
12 console.log(JSON.stringify(output));
13 existsAsync('./main.js').then(function (existence) {
14 console.log(existence);
15 fs.open('./main.js', 'r', function (error, fd) {
16 if (error) return;
17 readAsync(fd, Buffer.alloc(10), 0, 10, 0).then(function (tuple) {
18 console.log(JSON.stringify(tuple));
19 });
20 });
21 });
22});
23

Built with git-ssb-web