💾 Archived View for gmi.noulin.net › gitRepositories › git-off › file › src › node_modules › mkdirp … captured on 2023-01-29 at 13:12:05. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
perm.js (871B)
1 var mkdirp = require('../'); 2 var path = require('path'); 3 var fs = require('fs'); 4 var exists = fs.exists || path.exists; 5 var test = require('tap').test; 6 var _0777 = parseInt('0777', 8); 7 var _0755 = parseInt('0755', 8); 8 9 test('async perm', function (t) { 10 t.plan(5); 11 var file = '/tmp/' + (Math.random() * (1<<30)).toString(16); 12 13 mkdirp(file, _0755, function (err) { 14 t.ifError(err); 15 exists(file, function (ex) { 16 t.ok(ex, 'file created'); 17 fs.stat(file, function (err, stat) { 18 t.ifError(err); 19 t.equal(stat.mode & _0777, _0755); 20 t.ok(stat.isDirectory(), 'target not a directory'); 21 }) 22 }) 23 }); 24 }); 25 26 test('async root perm', function (t) { 27 mkdirp('/tmp', _0755, function (err) { 28 if (err) t.fail(err); 29 t.end(); 30 }); 31 t.end(); 32 });