git ssb

0+

cel-desktop / ssb-pkg



Tree: 938b7ea4cfaa3cef6e1690b9ef3ea8bd7a0d2de1

Files: 938b7ea4cfaa3cef6e1690b9ef3ea8bd7a0d2de1 / 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