git ssb

0+

cel-desktop / ssb-pkg



Tree: ca90b5ca0579ebdcc0635288bce4978e3fb200f5

Files: ca90b5ca0579ebdcc0635288bce4978e3fb200f5 / 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